Remove second class from an element and add another class
- by rahul
Hi,
$(document).ready ( function () {
$(".MenuItem").mouseover ( function () {
// Remove second class and add another class [ Maintain MenuItem class ]
// Eg: For div1 remove Sprite1 and then add Sprite1Dis and for div2
// remove Sprite2 and add Spprite2Dis
});
$(".MenuItem").mouseout ( function () {
// Reverse of mouseover. ie Remove Sprite1Dis and add Sprite1
});
});
<div id="div1" class="MenuItem Sprite1">
</div>
<div id="div2" class="MenuItem Sprite2">
</div>
<div id="div3" class="MenuItem Sprite3">
</div>
<div id="div4" class="MenuItem Sprite4">
</div>
<div id="div5" class="MenuItem Sprite5">
</div>
<div id="div6" class="MenuItem Sprite6">
</div>
My problem is listed as comment inside the code section. What will be the easiest way to achieve this?
Thanks in advance