I have开发者_运维问答 a tree structure menu. What I am trying to achieve is to add the '.toggle-me' class to the next submenu that shows up.
I have achieved this to some degree, although I need to some get the.not(this)
to include all .rtmenu
's before this
?
Here is the code I'm working with:
$('.rtmenu').live('click', function(){
$('.rtmenu:visible').not(this).addClass('toggle-me');
$('.toggle-me').toggle()
});
Please let me know if you need clarification. Much Appreciated, Thanks
I think you should try wrapping this
with jQuery, since this
is not a jQuery object:
$('.rtmenu:visible').not($(this)).addClass('toggle-me');
Additionally, i would omit the toggle-me
class. You could simply write:
$('.rtmenu:visible').not($(this)).toggle();
精彩评论