Reputation: 798
I am trying to create collapsible tree. I this my leaf nodes have class="member". The code highlights the path user is on in the tree. The problem is when i am using $(this).toggleClass("xyz"); it is removing my "member" class. I want to keep both class on leaf node
<li class="member xyz">Name</li>
using the member class I have css style that changes bullet images on my original code. so, i need to keep the member class.
Upvotes: 2
Views: 102
Reputation: 150108
Examine this code:
$("li.clickedli").removeAttr("class");
This removes the entire class attribute, thus removing all classes. Just set/clear the specific classes you need/don't need.
Upvotes: 5