Skip to content

Instantly share code, notes, and snippets.

@dustinpoissant
Created November 19, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dustinpoissant/0ff2b452ef2b8efb6308e2ab3269c4e0 to your computer and use it in GitHub Desktop.
Save dustinpoissant/0ff2b452ef2b8efb6308e2ab3269c4e0 to your computer and use it in GitHub Desktop.
jQuery hasAttr
$.fn.hasAttr=function(a){var b=$(this).attr(a);return void 0!==typeof b&&b!==!1};
$.fn.hasAttr = function(attrName){
var attr = $(this).attr(attrName)
return (
typeof(attr) !== undefined &&
attr !== false
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment