jquery select all checkboxes

前端 未结 19 2778
情书的邮戳
情书的邮戳 2020-12-13 12:36

I have a series of checkboxes that are loaded 100 at a time via ajax.

I need this jquery to allow me to have a button when pushed check all on screen. If more are lo

19条回答
  •  孤街浪徒
    2020-12-13 13:13

    It works for me (IE, Safari, Firefox) by just changing your this.checked to 'checked'.

    $(function() {
      $('#selectall').click(function() {
        $('#friendslist').find(':checkbox').attr('checked', 'checked');
      });
     });
    

提交回复
热议问题