关于jq操作table下多个type=radio的input的选中
2013-08-07 13:08
417 查看
假如有2个table:
<table id="table1" border="0">
<tr>
<td><input id="rdu_0" type="radio" name="rdu" value="1" checked="checked" /><label for="rdu_0">第一个</label></td>
</tr><tr>
<td><input id="rdu_1" type="radio" name="rdu" value="2" /><label for="rdu_1">第2个</label></td>
</tr><tr>
<td><input id="rdu_2" type="radio" name="rdu" value="3" /><label for="rdu_2">第3个</label></td>
</tr>
</table>
<table id="table2" border="0">
<tr>
<td><input id="rrr_0" type="radio" name="rrr" value="1" checked="checked" /><label for="rrr_0">第一个</label></td>
</tr><tr>
<td><input id="rrr_1" type="radio" name="rrr" value="2" /><label for="rrr_1">第2个</label></td>
</tr><tr>
<td><input id="rrr_2" type="radio" name="rrr" value="3" /><label for="rrr_2">第3个</label></td>
</tr>
</table>
在第一个table中的某个input选中之后,第二个table的所有input全部未选中
<script type="text/javascript">
$("#table1").find("input").click(function(){ //给table下的所有input加click事件
$("#table2").find("input").each(function(){//遍历所有table2下的input
$(this).attr("checked","");
})
})
</script>
<table id="table1" border="0">
<tr>
<td><input id="rdu_0" type="radio" name="rdu" value="1" checked="checked" /><label for="rdu_0">第一个</label></td>
</tr><tr>
<td><input id="rdu_1" type="radio" name="rdu" value="2" /><label for="rdu_1">第2个</label></td>
</tr><tr>
<td><input id="rdu_2" type="radio" name="rdu" value="3" /><label for="rdu_2">第3个</label></td>
</tr>
</table>
<table id="table2" border="0">
<tr>
<td><input id="rrr_0" type="radio" name="rrr" value="1" checked="checked" /><label for="rrr_0">第一个</label></td>
</tr><tr>
<td><input id="rrr_1" type="radio" name="rrr" value="2" /><label for="rrr_1">第2个</label></td>
</tr><tr>
<td><input id="rrr_2" type="radio" name="rrr" value="3" /><label for="rrr_2">第3个</label></td>
</tr>
</table>
在第一个table中的某个input选中之后,第二个table的所有input全部未选中
<script type="text/javascript">
$("#table1").find("input").click(function(){ //给table下的所有input加click事件
$("#table2").find("input").each(function(){//遍历所有table2下的input
$(this).attr("checked","");
})
})
</script>
相关文章推荐
- jq 操作radio,设置选中、获取选中值
- 动态input type="radio"选中,而不是赋值
- jquery根据特定的值设置 input type=radio 单选框为选中状态
- struts2 <input type="radio" 默认选中
- 关于如何给<input type="date">设置默认当前日期的方法 和 给table固定宽度
- jq操作radio,设置选中、获取选中值
- jQuery操作input type=radio的实现代码
- jq里面关于单选按钮 type="radio" 判断最优处理方法
- jq 操作radio,设置选中、获取选中值
- jq操作radio,设置选中、获取选中值
- 关于radio的相关操作以及input边框为0
- jQuery操作<input type="radio">
- Jquery操作Input之Select和Radio选中
- [转]jQuery操作<input type="radio">
- jQuery操作<input type="radio">
- 点击文字,把input type="radio"也选中
- 单选按钮选中与移除input type="radio" 以及复选框等
- jQuery操作input type=radio的实现代码
- 点击文字,把input type="radio"也选中
- 多个单选框 input type="radio"选中效果