Home › Forums › CSS › [Solved] jQuery: Menus appear/disappear on click › Re: [Solved] jQuery: Menus appear/disappear on click
November 22, 2010 at 2:11 pm
#72789
Member
I used this script before for a set of tabs I needed to implement, and it works fairly well*:
$(function(){
$('.section-title').click(function() {
$(this).next('.section-content').toggle().siblings('.section-content').hide();
});
});
For this HTML:
Products & Services (1)
1111
Support & Training (2)
2222
Communities (3)
3333
Store (4)
4444
*The problem I have is that I have no idea how to add/remove a class to the ‘section-title’ when another title gets clicked.
I’ve tried toggleClass but it only works if you click on its title again, not when you click on another.
Any idea how to add/remove a class ‘section-title’ when clicking on another title?