How to check if a browser has built-in HTML form validation ability? By doing so, we don't need to apply jQuery form validation functions on browsers who can validate form by themselves.
Simply check if the checkValidity()
function exists:
Demo: http://jsfiddle.net/ThinkingStiff/cmSJw/
function hasFormValidation() {
return (typeof document.createElement( 'input' ).checkValidity == 'function');
};
Call it like this:
if( hasFormValidation() ) {
//HTML5 Form Validation supported
};