本文主要为大家带来一篇jquery实现table中两列checkbox只能选中一个的示例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧,希望能帮助到大家。
//html
<table id="unit">
<tr>
<th>选项一</th>
<th>选项二</th>
<th>姓名</th>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td><input type="checkbox" /></td>
<td>小红</td>
</tr>
<tr>
<td><input type="checkbox" /></td>
<td><input type="checkbox" /></td>
<td>小明</td>
</tr>
</table>
//jquery
<script type="text/javascript">
$(function(){
$(#unit tr).click(function () {
$(this).siblings().find(input[type='checkbox']).removeattr(checked);
});
})
</script>
//效果图,暂时上传不了动态的,亲测有用的
相关推荐:
html的checkbox和radio怎样美化样式
input checkbox 如何可以扩大点击范围
jquery实现checkbox方法
以上就是table中两列checkbox只能选中一个的jquery代码的详细内容。