Select All checkbox by Javascript or console

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

    This JS code will check all checkboxed in your page:

    var a = document.querySelectorAll('input[type="checkbox"]');
    for (var i=0; i

    Live demo

    All you have to do then is create a bookmarklet with it, say, with this bookmarklet maker, which generates this bookmarklet code:

    javascript:var a=document.querySelectorAll('input[type="checkbox"]');for(var i=0;i

    Just add this URI to a bookmark in your bookmark toolbar, then all you have to do is click it whenever you need all the checkboxes in your page to be checked. =]

提交回复
热议问题