jquery table中点击某一行的按钮,获取这一行checkbox的选中状态 急求大佬解决,快崩溃了,搜的方法都不管用。。。

eqishan0339 2018-05-26 11:37:28
<table>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
</table>
...全文
1519 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
FFF279469961 2018-06-07
  • 打赏
  • 举报
回复
$(that).is(':checked');//这个that就是CheckBox
天际的海浪 2018-05-27
  • 打赏
  • 举报
回复

<table>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
<tr>
<td><input type="checkbox" class="check"></td>
<td><input type="button" class="add"></td>
</tr>
</table>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	$(".add").click(function(event){
		alert($(this).closest("tr").find(".check").prop("checked"));
	});
});
</script>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧