itzikb itzikb - 2 years ago 56
Javascript Question

onclick event toggle div that is exists more than 1 in different div

I uploaded my code into jsfiddle:
I'm trying to toggle the

when I click on


If u can see there is a multiple div called question, I don’t remember how to do that I am a little rusty.

Answer Source

You should use $(this).parent().next() instead DEMO

$("div.question").click(function() {

Also if you want to hide siblings and add slide effect you can do it like this DEMO

$("div.question").click(function() {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download