Select All checkbox by Javascript or console

后端 未结 9 1291
野性不改
野性不改 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:15

    Just paste one of these one-liners to your browser console:

    Tick all checkboxes:

    document.querySelectorAll('input[type="checkbox"]').forEach(e => e.checked = true);

    Untick all checkboxes:

    document.querySelectorAll('input[type="checkbox"]').forEach(e => e.checked = false);

提交回复
热议问题