Skip to content

Instantly share code, notes, and snippets.

@alpenzoo
Forked from bjorn-ali-goransson/jquery.hasattr.js
Created July 5, 2018 07:15
Show Gist options
  • Save alpenzoo/417bfc3ffa6305ea4c5b0d573a810942 to your computer and use it in GitHub Desktop.
Save alpenzoo/417bfc3ffa6305ea4c5b0d573a810942 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