Check all Checkboxes in Page via Developer Tools

后端 未结 8 1340
野性不改
野性不改 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:57

    You have it nearly correct. Just use

    aa[i].checked = "checked";
    

    inside the loop.

    Namely, you need to make sure that:

    1. "checked" is a string, not a variable identifier, and
    2. you index directly on aa, not aa.elements, which does not exist

提交回复
热议问题