How to set radio button status with JavaScript

前端 未结 8 1253
抹茶落季
抹茶落季 2020-12-04 21:11

What method would be best to use to selectively set a single or multiple radio button(s) to a desired setting with JavaScript?

相关标签:
8条回答
  • 2020-12-04 21:36

    Very simple

    radiobtn = document.getElementById("theid");
    radiobtn.checked = true;
    
    0 讨论(0)
  • 2020-12-04 21:37
    $("#id_of_radiobutton").prop("checked", true);
    
    0 讨论(0)
提交回复
热议问题