Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jQuery获取行的第一列_Jquery_Jquery Selectors - Fatal编程技术网

使用jQuery获取行的第一列

使用jQuery获取行的第一列,jquery,jquery-selectors,Jquery,Jquery Selectors,加价 <TABLE id=tblRoleHdr> <TBODY> <TR> <TD style="WIDTH: 1%"><INPUT id=rptParent_chkRoleHdr_0 class=1 type=checkbox name=rptParent$ctl00$chkRoleHdr jQuery1323238445410="2"> </TD>

加价

<TABLE id=tblRoleHdr>
    <TBODY>
        <TR>
            <TD style="WIDTH: 1%"><INPUT id=rptParent_chkRoleHdr_0 class=1 type=checkbox name=rptParent$ctl00$chkRoleHdr jQuery1323238445410="2"> </TD>
            <TD style="WIDTH: 50%"><INPUT id=rptParent_hidRoleID_0 value=1 type=hidden name=rptParent$ctl00$hidRoleID> <SPAN id=rptParent_lblRole_0>Admin</SPAN> </TD>
            <TD style="WIDTH: 1%"><INPUT id=rptParent_chkP1Hdr_0 class=Group1ColumnHdr1 type=checkbox name=rptParent$ctl00$chkP1Hdr group_role="1" jQuery1323238445410="4"> </TD>
            <TD style="WIDTH: 1%"><INPUT id=rptParent_chkP2Hdr_0 class=Group1ColumnHdr2 type=checkbox name=rptParent$ctl00$chkP2Hdr group_role="1" jQuery1323238445410="6"> </TD>
            <TD style="WIDTH: 1%"><INPUT id=rptParent_chkP3Hdr_0 class=Group1ColumnHdr3 type=checkbox name=rptParent$ctl00$chkP3Hdr group_role="1" jQuery1323238445410="8"> </TD>
        </TR>
    </TBODY>
</TABLE>
任务

如果我单击带有
class=GroupXColumnHdrY
的复选框,其中X和Y是数字,我想转到行的第一列并检索
rptParent\u chkRoleHdr\u 0的
class
复选框。我如何使用jQuery来实现它

$('#tblRoleHdr').find('[type="checkbox"]').filter('[class^="Group"]').bind('click', function () {
    var the_class = $(this).closest('tr').children().eq(0).children().attr('class');
    //console.log(the_class);
});
下面是一个JSFIDLE:

$('#tblRoleHdr').find('[type="checkbox"]').filter('[class^="Group"]').bind('click', function () {
    var the_class = $(this).closest('tr').children().eq(0).children().attr('class');
    //console.log(the_class);
});