Jquery:如何获取动态表td值?

Jquery:如何获取动态表td值?,jquery,Jquery,以下是表格的外观: <tr class="A" id="A${a.index}"> //id is generic like 1,2,3,4,5 <table id="mytable"> <tr> <td>a</td> <td>b</td> </tr> <tr>

以下是表格的外观:

<tr class="A" id="A${a.index}"> //id is generic like 1,2,3,4,5  
    <table id="mytable">
        <tr>
           <td>a</td>
            <td>b</td>
         </tr>
         <tr>
            <td>c</td>
             <td>d</td>
      </tr>
       </table>
   </tr>

I am creating a generic table using  <tr> id, based on generic <tr> id  I'm trying to get the td value 

上面的脚本将在第二个tr中迭代所有td值,但我只需要根据我的父tr id值获取td值(我的tr id是动态的,它总是在变化),我是Jquery的初学者,这个表是通用的,所以我面临一些困难,有人能帮我更正代码吗?如果是动态标记,您可以使用委托:

$( "body" ).delegate( "#mytable tr:nth-child(2) td", "each", function() {
 alert($(this).text());
});

我想这就是你要找的。检查表格行列的文本是否与包含行id的表格相同

$('#mytable tr:nth-child(2) td').each(function(){
    if($(this).text() === $("#mytable").parent().attr("id")) {
        alert($(this).text());
    }
});

@AnoopJoshi我的父tr是@AnoopJoshi我的id值是动态的,它将始终改变tr是否始终是第二个?您的标记无效,
表不能是
tr
@JSelser的直接后代是tr始终是第二个
$('#mytable tr:nth-child(2) td').each(function(){
    if($(this).text() === $("#mytable").parent().attr("id")) {
        alert($(this).text());
    }
});