JQuery点击行tr实现checkBox选中与未选中切换
作者:互联网
点击table中的行时checkbox选中,再次点击取消。如何将tr作为模板插入的话可以在每一行tr注册点击事件
<tr onclick=" $($(this).children()[0]).children()[0].checked = ! $($(this).children()[0]).children()[0].checked" > <td style="text-align: center; width: 10%;"> <input name="chercked" type="checkbox"/> </td> <td style="width:45%; text-align: center;" > </td> <td style="width:45%;text-align: center;"> </td> </tr>
当然也可以
$("#tables tbody tr").click(function (e) { var checkboxs = $($(this).children()[0]).children()[0] checkboxs .checked = !checkboxs .checked })
标签:JQuery,checkBox,checked,tr,点击,选中,checkboxs,children 来源: https://www.cnblogs.com/wxblogs/p/14756369.html