テーブル id="myTable" の各行の各セルを反復処理し、セルの子 div の ID を取得したいと考えています。
これまでのところ、次のようなものがあります。
$("td.theCell").each(function() {
var id = $(this).attr('id'); //this would give me the td id but I want its child div's id
});
私のhtmlは次のようなものです:
<table id='myTable'>
<tr>foo</tr>
<tr>bar</tr>
<td>foo</td>
<td class='theCell'>
<div id='myDiv'>foo</div>
</td>
<tr>foo</tr>
<tr>bar</tr>
</table>
これを行う良い方法を知っている人はいますか?前もって感謝します。