jquery怎么获取checkbox未被选中的该行呢

来源:百度知道 编辑:UC知道 时间:2024/05/18 11:04:24
比如如下代码,我想取得2222和3333的tr,用jquery怎么取得?
<table width="100%">
<tr>
<td><input type="checkbox" checked="checked" />1111</td>
<td>1111</td>
</tr>
<tr>
<td><input type="checkbox" />2222</td>
<td>2222</td>
</tr>
<tr>
<td><input type="checkbox" />3333</td>
<td>3333</td>
</tr>
</table>

你的checkbox没有ID吗!
如果有的话就这样写 if($("#ID").attr("checked")==true)
{
选中了!
}

//获取所有未选中的input标签
$('input[@type="checkbox"][@checked=""]').each(function(){
$(this).parent('td').parent('tr');//获取checkbox未被选中的该行
alert($(this).parent('td').parent('tr').innerHTML);//验证
});

$("td:contains('2222'),td:contains('3333')").parent('tr').each(function(){
alert($(this).text());
});