You're right, $('.linkify.map:first') will always return the first element that matches linkify.map. If you want to make it in respect to a container, try $('#container').find('.linkify.map')
-Hector On Wed, Nov 12, 2008 at 11:49 AM, alanfluff <[EMAIL PROTECTED]>wrote: > > Almost what I want - but the first map is always the one shown, I > could have explained better, my bad, sorry. > > Pseudo code for what I have: > . > . > click-to-trigger-map > mapOne[div] > . > . > click-to-trigger-map > mapTwo[div] > . > . > etc > > The :first seems to make mapOne display, regardless which click-to- > trigger I click. > > It looks as if the scope of the :first is the whole DOM and no > starting from the point where the click occurred and affecting the > first instance after it (which is what I want). > > Thanks in advance for any further help! Cheers, -Alan > > > On Nov 12, 2:36 pm, alanfluff <[EMAIL PROTECTED]> wrote: > > Thanks _lots_ for the quick reply Hector -- I'll go try that. Cheers! > > > > On Nov 12, 2:22 pm, "Hector Virgen" <[EMAIL PROTECTED]> wrote: > > > > > Try $('.linkify.map:first'). That should return the first matched > element. > > > -Hector > > > > > On Wed, Nov 12, 2008 at 11:04 AM, alanfluff > > > <[EMAIL PROTECTED]>wrote: > > > > > > Hi, > > > > > > I am trying to limit the scope of a click trigger to the first/next > > > > matched target. > > > > > > This works fine if I have one container of class .expander.map but as > > > > soon as I add another, they both respond (I guessed they would ;) > > > > > > $('.linkify.map').click(function() { > > > > $('.expander.map').show(); > > > > }); > > > > > > I have tried using $(this) and .next() but likely not correctly... > > > > > > I am _certain_ this is stupidly simple and I am missing the obvious. > > > > > > Grateful if anyone can point me in the right direction. > > > > > > Cheers lots in advance! > > > > > > [I am a lightweight (little experience) when it comes to JavaScript/ > > > > jQuery, so much so that even though I have jQuery Ref and Learning > > > > books, I still have not sussed this. What am I like...] >