Normally you can remove class by giving its name like
... you can provide more than one class like
you have three classes color-red, color-blue, color-green you want to remove all three classes without providing the name of all.
Try following technique
$("element").removeClass("className");
... you can provide more than one class like
$("element").removeClass("className otherClass thirdClass");but there is no built-in function in JQuery to remove classes using wildcards.
you have three classes color-red, color-blue, color-green you want to remove all three classes without providing the name of all.
Try following technique
$("element").attr("class", function(pos, classes){ return classes.replace(/\bbox-\S+/g, ""); });
0 comments:
Post a Comment
comment or ask