Reputation: 20965
Not sure if I've just missed something but this doesn't work:
$(this).children('td.threadtitle a').html('thread title');
However this does
$(this).children('td.threadtitle').children('a').html('thread title');
I'm just trying to understand why this is occuring. But is this a bug?
Upvotes: 1
Views: 118
Reputation: 239950
The selector argument to .children
is a filter. $(this).children('td.threadtitle a')
finds nodes which match the selector td.threadtitle a
and are direct children of this
. Assuming that your threadtitle td
s are inside of this
, and not above or equal to it, this situation will never happen.
I think that what you might really be looking for is a contextualized selector:
$('td.threadtitle a', this).html("Thread title")
which finds things that match that selector as long as they occur anywhere under this
.
Upvotes: 2
Reputation: 138017
children
, you should use "td.threadtitle > a"
. Otherwhise it should be find('a')
.Upvotes: 0