Created
November 20, 2015 07:40
-
-
Save bjorn-ali-goransson/d013fb2dcf8d24efd10a to your computer and use it in GitHub Desktop.
jQuery hasAttr function
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
/* 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