Skip to content

Instantly share code, notes, and snippets.

@eatonphil
Created February 2, 2015 16:36
Show Gist options
  • Save eatonphil/ef39c7a083bdc154f1a4 to your computer and use it in GitHub Desktop.
Save eatonphil/ef39c7a083bdc154f1a4 to your computer and use it in GitHub Desktop.
/*
* Original Source: http://stackoverflow.com/questions/1318076/jquery-hasattr-checking-to-see-if-there-is-an-attribute-on-an-element
*
* jQuery add-on to check if an element has an attribute.
*/
jQuery.fn.hasAttr = function(name) {
return typeof this.attr(name) === typeof undefined || this.attr(name) === false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment