Last active
October 21, 2018 03:49
-
-
Save blubbll/c2bc4ae0fd4d0d1c4e9696dce4e439b5 to your computer and use it in GitHub Desktop.
jQuery addAttr / has Attr
This file contains hidden or 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
| //jQuery extenden | |
| jQuery.fn.extend({ | |
| addAttr: function(arg) { | |
| $(this).is("[" + arg + "]") || $(this).attr(arg, ""); | |
| return this; | |
| }, | |
| hasAttr: function(arg) { | |
| return ($(this).is('[' + arg + ']')); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment