I want three < li > appended in the aside area of the body of the HTML document
</aside>
<div id="id1" > I am the one </div>
<div id="id2" > I am the second</div>
<div id="id3" > I am the third</div>
</body>
For example the < li > Hey1 attached click function will ONLY toggle the div with the id="id1" and so on
the code I have written is
$(document).ready(function() { $("div").hide();
jQuery.each([1,2,3], function(n,value){ n++;
$('aside').append("<li> hey"+value+" </li>").click(function(){$('#id'+value).toggle()});
});
})
Now the code creates the < li > 's all right and it attaches to them the click function.
The problem is that whichever of the < li > I click
all three of the < div > s toggle
when what i specifically want
is that when , say
the < li > Hey1 is clicked THEN ONLY the area with the
< div id="id1" > I am the one < /div>
will be shown and hidden.
I am thankful to any help