Last active
December 16, 2015 18:20
-
-
Save csdy/5477178 to your computer and use it in GitHub Desktop.
jQuery validation with HTML5 browser validation fallback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- jQuery --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-2.0.3.min.js"><\x3C/script>')</script> | |
<!-- jQuery Validate --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.11.1/jquery.validate.min.js"></script> | |
<script>window.jQuery.validator || document.write('<script src="/js/vendor/jquery.validate-1.11.1.min.js"><\x3C/script>')</script> | |
<script> | |
// DOM ready | |
$(function() { | |
// Check dependencies | |
if(window.jQuery && window.jQuery.validator) { | |
// Disable native validation | |
$('form').attr('novalidate', 'novalidate'); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment