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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -