javascript - how form.checkValidity() working -
i reading website code using mvc
, strugling reading code.
here piece of code of view
<script type="text/javascript"> function submitform(action){ var forms = document.getelementbyid('form'); forms.action = action; if(forms.checkvalidity()){ forms.submit(); } else{ alert("there still empty field"); } } </script>
i want function exception or something, want customisation, don't know start.please give me answer.
checkvalidity()
html5 method ,
when checkvalidity() method invoked, if element candidate constraint validation , not satisfy constraints, user agent must fire simple event named invalid cancelable (but in case has no default action) @ element , return false. otherwise, must return true without doing else.
please learn more how use form validation constraints here. there number of useful methods can use, customize , build custom validation methods.
you can find basic explanation , examples in w3schools. hope helps.
Comments
Post a Comment