Also, you could do it XPath style (untested): $(this).find('/span/a').html('it works');
For more info, check out: http://docs.jquery.com/DOM/Traversing/Selectors --Erik On 8/28/07, Erik Beeson <[EMAIL PROTECTED]> wrote: > Your last guess is the right idea, but not valid javascript syntax. Maybe try: > > $(this).find(">span>a").html("it works"); > > If you just want all of the anchors under 'this', you can do: > > $(this).find('a').html(...); > > If you know the ID of the element you're looking under, you can do: > > $('#container > span > a').html('it works'); > > Or: > > $('#container a').html('it works'); > > Depending on what anchors you want. > > --Erik > > > On 8/28/07, Nico <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I'm trying to optimize this selector: > > > > $(this).children("span").children("a").html("it works"); > > > > Because I think that these 2 .children are not "light" javascript > > > > My HTML: > > <div id="container"> > > <span> > > <a href="#">My link</a> > > </span> > > </div> > > > > I try something like $(this > "span > a").html("it works"); > > > > But it doesn't work. > > > > I'm sure that it's a dummy question but i doesn't find by myself... > > thanks for your help. > > > > >