Code: JavaScript Fallback for the HTML5 required attribute

Since the Safari browser doesn’t show a notice for empty input elements attached with the required attribute, a JavaScript fallback using the alert() function can be used instead.

I took the liberty to enhance the following solution http://wideline-studio.com/blog/html5-form-features-and-their-javascript-fallbacks to to its use of the deprecated jQuery.browser property, and having it coded for testing purposes only.

Please use the following code instead:

Resources: http://stackoverflow.com/questions/12625876/how-to-detect-chrome-and-safari-browser-webkit

Enjoy,
Yaniv

Published by

Yaniv Friedensohn

I am a Codeable developer (only top 3% of developers are accepted) specializing in creating advanced WordPress and WooCommerce solutions for clients worldwide. Projects include developing a custom shopping workflow and adding functionality to existing plugins. You can contact me at [email protected]