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.
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
Post a Comment