Isn't that basically: if ($('.container a:first').length) $('.container').css('background-color', 'red');
Unless I misunderstand what you're asking for? -- dz On Fri, Feb 6, 2009 at 6:58 AM, Jörn Zaefferer <joern.zaeffe...@googlemail.com> wrote: > > I'm trying to solve the follow selector problem: Assuming two > container elements that both have arbitrary descendents. Given a > jQuery object containing these containers and one descendent of any of > these, whats the most effecient way to find the correct parent > element? Neither parents() nor closest() helps, as there is no > sufficient simple selector available. > In other words, I want to filter a selection by a descendent. > > My naiive implementation goes through all descendents, which isn't > really acceptable: http://jsbin.com/uhama/edit > > Ideas? > > Jörn > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---