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 to to its use of the deprecated jQuery.browser property, and having it coded for testing purposes only.

Please use the following code instead:



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]