Check all Checkboxes in Page via Developer Tools

后端 未结 8 1413
野性不改
野性不改 2021-01-30 05:13

I have a loop that creates 20 check-boxes in the same page (it creates different forms). I want via chrome developer tools to

8条回答
  •  误落风尘
    2021-01-30 05:50

    Javascript function to toggle (check/uncheck) all checkbox.

    function checkAll(bx)
    {
     var cbs = document.getElementsByTagName('input');
     for(var i=0; i < cbs.length; i++)
     {
        if(cbs[i].type == 'checkbox')
        {
            cbs[i].checked = bx.checked;
         }
     }
    }
    

    If you want to it from developer tools then remove parameter of function and put the value as "true" or "false" instead of "bx.checked"

提交回复
热议问题