Reputation: 13
my entire jQuery code looks like this:
$(function(){
$(".details").hide();
$("li").mouseenter(function(){
$(this).css("color","blue");
});
$("li").mouseleave(function(){
$(this).css("color","black");
});
$("li").click(function(){
$(this).next().slideToggle();
$(".details").not(this.next()).slideUp();
});
});
the only line not working is
$(".details").not(this.next()).slideUp();
I cannot for the life of me figure out how to use slideUp() on every li with the details class except for the li that I just used slideToggle() on.
Upvotes: 1
Views: 55
Reputation: 2823
Before calling next()
inside not()
, wrap (convert) this
into a jquery selector.
$(".details").not($(this).next()).slideUp();
Upvotes: 1