これは私が試したものよりも簡単かもしれません。<div>
などの のセットが<div id="site-abc" .. "site-def">
あり、それぞれに同様の HTML コンテンツがあります。DIV には のような複数のクラスがあり"ui-tabs-panel class2 ui-tabs-hide"
ます。1 つには ui-tabs-hide がありません。そのためのセレクターが必要であり、そこから bingo! 内の DIV 内で一意のテキストを見つける必要があります。
次の手順に適した jQuery セレクター コードは何ですか。A) find right <div>
with class="ui-tabs-panel"
but NOT CONTAINING "ui-tabs-hide"
; B) そのセレクターの結果を取得し、 ?を検索('th.target2')
して取得します。.text()
var tabs = $('#editors.not(.ui-tabs-hide');
var my_text = tabs.find('th.target2').text();
<div class="grid-editor">
<div id="editors" class="ui-tabs">
<div id="site-abc" class="ui-tabs-panel class2 ui-tabs-hide">
//duplicates HTML like "site-ghi" including <th>bingo!</th>
</div>
<div id="site-def" class="ui-tabs-panel class2 ui-tabs-hide">
//duplicates HTML like "site-ghi" including <th>bingo!</th>
</div>
<div id="site-ghi" class="ui-tabs-panel class2”>
<table class=”my-table”>
<thead>
<tr>
<th class="target1">abc1</th>
<th class="target2">bingo</th>
</tr>
</thead>
</div>
</div>
</div>