Removing all Matching Classes in jQuery
- by Seth Duncan
Hi I have an li element that will have something along the lines of this for a declaration
<li class="module ui-helper-fix">
And I can dynamically change the color of the module by adding on classes (That are provided dynamically through DB calls) the end result being
<li class="module ui-helper-fix module-green">
or
<li class="module ui-helper-fix module-default">
Well I am fine with changing the color by adding on a new module-WHATEVER class but what I would like to do is remove any class that matches module-XXXX so it starts with a clean slate and then add on the class module-crimson.
So how do I remove all classes that match module-xxx first ? Keeping in mind I don't want to remove the base module class.
Thanks.
-Seth