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

Yaniv Friedensohn is a marketing developer trying to merge his programming capabilities and online marketing knowledge towards maximizing marketing performance. You can contact him at [email protected]