<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="./jquery-1.7.2.min.js"></script>
</head>
<body>
<p><input type="checkbox">林志玲</p>
<p><input type="checkbox">杨幂</p>
<p><input type="checkbox">迪丽热巴</p>
<p><input type="checkbox">邓伦</p>
<p><input type="checkbox">朱一龙</p>
<button>全选</button>
<button>反选</button>
<button>删除</button>
</body>
<script>
$('button:first').click(function(){
$(':checkbox').attr('checked',true);
}).next().click(function(){
$(':checkbox').each(function(){
$(this).attr('checked',!$(this).attr('checked'));
})
}).next().click(function(){
//被选中的删除
$(':checked').parent().remove();
})
</script>
</html>
JQuery 实现 全选/反选/删除
最新推荐文章于 2022-05-10 09:00:00 发布