Home » Javascript » required with input and javascript not working

required with input and javascript not working

Posted by: admin October 29, 2018 Leave a comment

Questions:

I would like to set a required before submitting but isn’t work any idea? May over JS ? Thank you for your support

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<tr><td><input type="text" size"30" placeholder="Text " maxlength="10" id="source" required>
<button type="submit" class="formButton" id="submit">Submit</button></td></tr>

<tr><td height="20px"></td></tr>                            
<tr><td><input type="text" style="border:none" size="40" id="target" class="form69" onClick="myFunct()"></td></tr>
<tr><td height="150px"></td></tr>   

<script>
$(".formButton").click(function() {
 $(".form69").show();
});
</script>

<script>
$('#submit').click(function(){
var source = $('#source').val();
$('#target').val('text test' + source + ' text');
}); 
</script> 
Answers: