Check a radio button with javascript

前端 未结 6 1668
一个人的身影
一个人的身影 2020-11-27 04:22

For some reason, I can\'t seem to figure this out.

I have some radio buttons in my html which toggles categories:



        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 04:41

    By using document.getElementById() function you don't have to pass # before element's id.

    Code:

    document.getElementById('_1234').checked = true;
    

    Demo: JSFiddle

提交回复
热议问题