当前位置:Gxlcms > JavaScript > jquery实现的复选框全选与反选

jquery实现的复选框全选与反选

时间:2021-07-01 10:21:17 帮助过:11人阅读

此代码简单但适用。

var tog = false;
// or true if they are checked on load 
$('a').click(function() { 
  $("input[type=checkbox]").attr("checked",!tog); 
  tog = !tog; 
});

需要的码农可以拿去实验一下,效果不错。

人气教程排行