何かを見逃しただけかどうかはわかりませんが、これは機能しません:
$(this).children('td.threadtitle a').html('thread title');
ただし、これは
$(this).children('td.threadtitle').children('a').html('thread title');
なぜこれが起こっているのかを理解しようとしています。しかし、これはバグですか?
何かを見逃しただけかどうかはわかりませんが、これは機能しません:
$(this).children('td.threadtitle a').html('thread title');
ただし、これは
$(this).children('td.threadtitle').children('a').html('thread title');
なぜこれが起こっているのかを理解しようとしています。しかし、これはバグですか?
へのセレクタ引数.children
はfilterです。セレクターに一致し、の直接の子で$(this).children('td.threadtitle a')
あるノードを検索します。threadtitleが の内側にあり、それ以上ではないと仮定すると、この状況は決して起こりません。td.threadtitle a
this
td
this
あなたが本当に探しているのは、コンテキスト化されたセレクターだと思います。
$('td.threadtitle a', this).html("Thread title")
の下のどこかにある限り、そのセレクターに一致するものを見つけますthis
。
children
、 を使用する必要があります"td.threadtitle > a"
。それ以外の場合はfind('a')
.