Find out if a radio button is checked or not:
var x = document.getElementById("myRadio").checked;
Click the button to find out whether the radio button is checked, or not.
<!DOCTYPE html> <html> <body> Radio button:<input type="radio" id="myRadio" checked> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w . ja v a2 s . c o m*/ var x = document.getElementById("myRadio").checked; document.getElementById("demo").innerHTML = x; } </script> </body> </html>