Select All checkbox by Javascript or console

后端 未结 9 1296
野性不改
野性不改 2021-01-31 05:01

I am having 100 Checkboxes on my web page. For testing purposes I want to tick all those boxes, but manually clicking is time consuming. Is there a possible way to get them tick

9条回答
  •  温柔的废话
    2021-01-31 05:39

    by using jquery, simple as that

    $('input:checkbox').each(function () {
       // alert(this);
       $(this).attr('checked', true);
      });
    

    Or simply use

    $('input:checkbox').prop('checked', true);// use the property
    

    OR

     $('input:checkbox').attr('checked', true); // by using the attribute
    

提交回复
热议问题