How to remove all classes starting with the prefix

Possible duplicate:
jQuery removeClass jQuery wildcard
- select the element the class starts with

I have some divs that belong to a zone (a div can have a class of "zoneA", another div can have a class of "zoneB, etc.). I want to be able to select several partitions of this type and set a new class for them.

So, I would like to do something like:

$(".selected-divs").removeClass("zone*").addClass(".zone-new")

How to remove all classes in this maner?

+3
source share

All Articles