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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -