Skip to content

Instantly share code, notes, and snippets.

@baileylo
Created April 23, 2011 23:34
Show Gist options
  • Save baileylo/939084 to your computer and use it in GitHub Desktop.
Save baileylo/939084 to your computer and use it in GitHub Desktop.
Simple check api wrapper for jquery
(function( $ ){
$.fn.checkValidity = function() {
var html_object = this.get.(0);
if (typeof html_object.checkValidity != 'function') {
switch(this.attr('type')) {
case 'email':
// add email validation
break;
case 'url':
// Add url validation
break;
}
return true;
} else {
return html_object.checkValidity();
}
};
})( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment