How to clear radio button in Javascript?

后端 未结 10 563
予麋鹿
予麋鹿 2020-12-02 19:57

I have a radio button named \"Choose\" with the options yes and no. If I select any one of the options and click the button labeled \"clear\", I need to clear the selected o

10条回答
  •  时光取名叫无心
    2020-12-02 20:35

    In my case this got the job done:

    const chbx = document.getElementsByName("input_name");
    
    for(let i=0; i < chbx.length; i++) {
        chbx[i].checked = false;
    }
    

提交回复
热议问题