I would like to replace the class's suffix while preserving its prefix
DEMO: http://jsbin.com/vozufura/4/edit
The desired code should make all the div black. So that:
- class= menu-456 AND menu-789 should be replaced and become menu-123
- All the div should be black as a result
HTML:
<div class="menu-123">black</div>
<div class="menu-456">green</div>
<div class="menu-789" >red</div>
CSS:
.menu-123 {
background: black;
}
.menu-456 {
background: green;
}
.menu-789 {
background: red;
}
Javascript (Jquery):
/* I am not looking for javascript like removeClass nor addClass,
nor do i want to change the background.
I wanted to know if it is possible to REPLACE the suffix of a class*/