[jQuery] Re: How optimize $(this).children("span").children("a").html("it works");

2007-08-28 Thread Brandon Aaron
This should work then: $('> span > a', this).html('it works'); -- Brandon Aaron On 8/28/07, Erik Beeson <[EMAIL PROTECTED]> wrote: > > > > > $(this).children("span").children("a").html("it works"); > > I would have chosen the following > > $("span a",this).html("it works"); > > I think that isn'

[jQuery] Re: How optimize $(this).children("span").children("a").html("it works");

2007-08-28 Thread Erik Beeson
> > $(this).children("span").children("a").html("it works"); > I would have chosen the following > $("span a",this).html("it works"); I think that isn't quite the same thing. In the following, your suggestion would match 3 anchors, and the OP's would just match the first one: ... ... ...

[jQuery] Re: How optimize $(this).children("span").children("a").html("it works");

2007-08-28 Thread Sean Catchpole
On 8/28/07, Nico <[EMAIL PROTECTED]> wrote: > > $(this).children("span").children("a").html("it works"); > I would have chosen the following $("span a",this).html("it works"); ~Sean

[jQuery] Re: How optimize $(this).children("span").children("a").html("it works");

2007-08-28 Thread Erik Beeson
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. Ma

[jQuery] Re: How optimize $(this).children("span").children("a").html("it works");

2007-08-28 Thread Erik Beeson
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