No, jQuery automatically assigns events to the entire selector set: $(function(){ $("#Comments a").click(function(){ /* All anchors will perform this function when clicked */ $(this).next(" div.Comment:eq(0)").fadeIn("slow"); /* Note the use of the "this" keyword */ }); });
Assuming your HTML document looks like this: <div id="Comments"> <a href="#" title="View Comment">View the first comment</a> <div class="Comment" style="display:none;"> Here is my first comment </div> <a href="#" title="View Comment">View the second comment</a> <div class="Comment" style="display:none;"> Here is my Second comment </div> </div> That should work for you. For more information on how selectors and event assignment works check out: http://docs.jquery.com/Core/jQuery#expressioncontext http://docs.jquery.com/Types#Element - jake On Dec 1, 2007 10:00 AM, msjoedin <[EMAIL PROTECTED]> wrote: > > > Hi all! > > I am struggling to make my first jQuery implementation and I really would > need some help. Here's my thing... > > I have a list of Click here to view comments and I then want to call the > fadeIn("normal") on the comment div. Do I need to use the foreach for each > object? Or is there any other smart way to do this? > > / Mats > > -- > View this message in context: > http://www.nabble.com/list-items-and-show-comments--NEWBIE-tf4928469s27240.html#a14106081 > Sent from the jQuery General Discussion mailing list archive at Nabble.com > . > >