上项目开发,忙的焦头烂额,博客也没咋更新了。

昨天老师提了个需求,简单的小例子,选择tr中任一行选中tr,觉得很有意思,记录一下:

上代码

<!DOCTYPE html>
<html>
<head>
	<title>更新checked</title>
</head>
<script src="E:\java jar\jquery\jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).on("click","#table1 tr td:not(:first-child)",function(){
	var obj = $(this).parent().find("td:first").find("input");
    obj.prop("checked", !obj.is(":checked"));
})
</script>
<body>
<table >
<tr >
<td><input type="checkbox" name="stuId"></td>
<td><p >StudentName</p></td>
<td><p >StudentNo</p></td>
<td><p >StudentNo</p></td>
</tr>
</table>
</body>
</html>

 作用就是选择tr中任意部分,选中此条记录。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-05
  • 2021-07-05
  • 2021-11-30
  • 2021-06-02
  • 2022-02-19
  • 2022-12-23
相关资源
相似解决方案