Check a radio button with javascript

前端 未结 6 1661
一个人的身影
一个人的身影 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:27

    Do not mix CSS/JQuery syntax (# for identifier) with native JS.

    Native JS solution:

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

    JQuery solution:

    $("#_1234").prop("checked", true);

提交回复
热议问题