Reputation: 1422
I have this menu: https://jsfiddle.net/sLu6cja8/1/
And I'm trying to use this javascript to toggle the content of a single section while clicking the "+"
$(".singleproject").hide();
$(".plus").click(function()
{
$(this).parent().next('.singleproject').toggle();
});
Any idea what am I doing wrong?
Upvotes: 1
Views: 429
Reputation: 773
The plus div and the content divs are siblings, so you don't need to go up to parent to access them:
https://jsfiddle.net/sLu6cja8/1/
$(".singleproject").hide();
$(".plus").click(function() {
$(this).next('.singleproject').toggle();
});
Upvotes: 1