jquery - Locate an element and change the class -
i trying change class of div
divprintdetailed divprintselected
<div id= "maindiv" class ="maindiv"> <div id ="partialviewdiv"> <div class="ui-submenu"> </div> <div id="reportcontainer" class="divprintdetailed"></div> </div> </div>
the following line of code doesn't job. doing wrong.
$('#maindiv').find('div.divprintdetailed').attr('class', 'divprintselected');
try this:
demo both versions.
$('#maindiv').find('div.divprintdetailed').removeclass('divprintdetailed').addclass('divprintselected');
and change html maindiv has id:
<div id="maindiv" class ="maindiv">
you can use toggleclasse() like:
$('#maindiv').find('div.divprintdetailed,div.divprintselected').toggleclass('divprintdetailed divprintselected');
Comments
Post a Comment