The Input Radio object represents an HTML <input> element with type="radio".
We can access an <input> element with type="radio" via document.getElementById()
:
var x = document.getElementById("myRadio");
Click the button to check the radio button.
<!DOCTYPE html> <html> <body> Radio Button: <input type="radio" id="myRadio"> <button onclick="myFunction()">Test</button> <script> function myFunction() {/*from w w w . j av a2 s . c om*/ var x = document.getElementById("myRadio"); x.checked = true; } </script> </body> </html>