Is it possible to add required
on different form, before execute button?
let say I have a HTML code when I used this code in JS:
$(function() {
$('#button1').click(function() {
$("#email").prop('required', true);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<input type="text" id="email" name="email" placeholder="Email*">
</form>
<form>
<button id="button1">Submit</button>
</form>
the button keep execute even the textfield
of email is null,
expected result: need to show this text if input field is null when click the button