源码:

<input type="checkbox" />全选

<div class="list">

  <input type="checkbox" />复选一

  <input type="checkbox" />复选二

  <input type="checkbox" />复选三

</div>

 

脚本:

$('#cleckAll').click(function(){

  if($(this).is(':checked')){

    $('.list input').prop('checked',true);

  }else{

    $('.list input').prop('checked',false);

  }

})

 

注:这里用prop()  就别用 attr() 了, 否则你会很迷惘...

解:问题源了jQuery的版本问题,就不再详解了...

 

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2021-05-24
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-17
  • 2022-01-25
  • 2022-01-24
  • 2022-12-23
  • 2022-01-02
  • 2021-12-27
相关资源
相似解决方案