Rename multiple css with identical name -
i'm working inside templated system can implement code, can't modified core of file. layer stacked this:
<div class="layer1"> <div class="layer2"> <div class=" layer3"> <div class="layer4"> </div> </div> </div> </div> <div class="layer1"> <div class="layer2"> <div class=" layer3"> <div class="layer4"> </div> </div> </div> </div> <div class="layer1"> <div class="layer2"> <div class=" layer3"> <div class="layer4"> </div> </div> </div> </div>
as can see, class have same name (layer1, layer2, etc...). want know if there's way using javascript, jquery or other online client side library modify css class name so, example, first layer1 become level1 , following layer1 become level 2?
thank answer!
as other people said, jquery want.
as long don't know number of “layers” have, better find elements classname substring:
$('*[class^="layer"]')
then can get list of element classes , change old names new ones.
Comments
Post a Comment