I'm trying to change the class of the element #sidePanel
from .compact
to .expanded
dynamically in this code snippet:
<div id="sidePanel" class="compact"></div>
<div id="topbar">
<div id="buttonContainer">
<div id="button"></div>
</div>
</div>
I've hit a roadblock and can't figure out how to apply the class to the correct <div>
; currently, I'm only able to add the class to the top bar. Here's what I have tried:
$(document).ready(function(){
$("#button").mouseover(function(){
$("this").parent().eq(2).addClass(".expanded").removeClass(".compact");
});
});
I also attempted this method:
$(document).ready(function(){
$("#button").mouseover(function(){
$("#sidepanel").addClass(".expanded").removeClass(".compact");
});
});