Created
November 1, 2017 16:51
-
-
Save lenivene/efdb592dccfbc1daf535e329c25cbc8b to your computer and use it in GitHub Desktop.
jQuery function Remove Class by Prefix
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
$.fn.removeClassPrefix = function( prefix ){ | |
var element = jQuery(this); | |
return this.each(function(){ | |
var c = this.classList; | |
jQuery.each(c, function(i, className) { | |
if( className.indexOf( prefix + "-" ) > -1 ){ | |
element.removeClass( className ); | |
} | |
}); | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment