Wonderfull! :-) It works with this one: $(this).find('/span/a').html('it works');
Thanks a lot for your help On 28 août, 12:48, "Erik Beeson" <[EMAIL PROTECTED]> wrote: > 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.