此代码简单但适用。

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

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

收藏 打印