How to force an HTML form to validate without submitting it via jQuery

To check whether a certain field is valid, use:

$('#myField')[0].checkValidity(); // returns true|false

To check if the form is valid, use:

$('#myForm')[0].checkValidity(); // returns true|false

Show html5 built-in error

if (! $('#myForm')[0].checkValidity()) {
      $('#myForm')[0].reportValidity()
}

Keep in mind that, HTML5 validation is not supported in all browsers till now.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)