html - Distinguishing and Processing Only One Div Item with JQuery -


i creating list item folding/unfolding css , jquery.

when click first item unfold it, items unfolded because names of class same.

can distinguish 1 item list keeping class names same?

my code below , sharing same class name.

<div class="flip">unfold!</div> <div class="panel">hello<br>this first</div>  <div class="flip">unfold 2!</div> <div class="panel">hello<br>this second</div> 

and jquery code below

$(document).ready(function(){ $(".flip").click(function(){ $(".panel").slidedown("slow"); }); }); 

does jquery have command distinguish items?

you can around source below well.

http://jsfiddle.net/qmavqug6/

thanks in advance help.

the .panel element want target next sibling of clicked flip, use .next() find target panel

$(document).ready(function () {     $(".flip").click(function () {         $(this).next(".panel").slidedown("slow");     }); }); 

demo: fiddle


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -