Created
October 14, 2011 09:43
-
-
Save craigmdennis/1286698 to your computer and use it in GitHub Desktop.
Remove a class on a wildcard basis
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
function removeWildcardClass(string, element) { | |
$(element).each(function () { | |
var aryClasses = $(this).attr('class').split(' '); | |
for (var i = 0; i < aryClasses.length; i++) { | |
if (aryClasses[i].indexOf(string) != -1) { | |
$(this).removeClass(aryClasses[i]); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would like to turn into plugin to mimic existing
.removeClass('class-name');
behaviour