Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery remove array of classes

/*
.removeClass( [className] ):classNameOne or more space-separated classes 
	to be removed from the class attribute of each matched element.

So, join all the classes you want to remove into a space separated list.
*/

var classesN = [class1, class2, class3];
var classesAlpha = [classA, classB, classC];

$('#alphas').click(function() {
   $('div').removeClass(classesAlpha.join(' '));
});
$('#numbers').click(function() {
   $('div').removeClass(classesN.join(' '));
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #remove #array #classes
ADD COMMENT
Topic
Name
4+2 =