How to uncheck a checkbox in pure JavaScript?

后端 未结 4 1992
萌比男神i
萌比男神i 2020-12-10 00:40

Here is the HTML Code:

4条回答
  •  旧时难觅i
    2020-12-10 01:12

    There is another way to do this:

    //elem - get the checkbox element and then
    elem.setAttribute('checked', 'checked'); //check
    elem.removeAttribute('checked'); //uncheck
    

提交回复
热议问题