Skip to content

Instantly share code, notes, and snippets.

@bjorn-ali-goransson
Created November 20, 2015 07:40
Show Gist options
  • Save bjorn-ali-goransson/d013fb2dcf8d24efd10a to your computer and use it in GitHub Desktop.
Save bjorn-ali-goransson/d013fb2dcf8d24efd10a to your computer and use it in GitHub Desktop.
jQuery hasAttr function
/* HAS ATTRIBUTE */
$.fn.hasAttr = function(attrName){
var element = this[0];
if(element.hasAttribute){
return element.hasAttribute(attrName);
}
return element[attrName] !== undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment