OK, try this. The form is basically as before:
<section>
<h2>Test</h2>
<form id="form">
<input type="text" name="test" id="test" required/>
<input type="submit" value="Test"/>
</form>
</section>
Then bind the submit
event to a function which calls the checkValidity()
method:
function manualValidate(ev) {
ev.target.checkValidity();
return false;
}
$("#form").bind("submit", manualValidate);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…