Skip to content

Instantly share code, notes, and snippets.

@lenivene
Created November 1, 2017 16:51
Show Gist options
  • Save lenivene/efdb592dccfbc1daf535e329c25cbc8b to your computer and use it in GitHub Desktop.
Save lenivene/efdb592dccfbc1daf535e329c25cbc8b to your computer and use it in GitHub Desktop.
jQuery function Remove Class by Prefix
$.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