I have a HTML5 form with required fields:
<form id="my_form">
<input type="text" name="myfield1" required>
<input type="text" name="myfield2" required>
<input type="text" name="myfield3" required>
<button type="button" id="my_button">Check</button>
</form>
Also, I have the following jQuery code:
$('#my_button').on('click', function() {
if ($('#my_form').checkValidity() == false) {
//show errors
}
});
I would like to force show HTML5 errors in //show errors
line.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…