find out whether the radio button is checked, or not

PHOTO EMBED

Sun May 08 2022 11:51:48 GMT+0000 (Coordinated Universal Time)

Saved by @Wchoi189 #undefined

<!DOCTYPE html>
<html>
<body>
​
Radio button:<input type="radio" id="myRadio" checked>
​
<p>Click the "Try it" button to find out whether the radio button is checked, or not.</p>
​
<button onclick="myFunction()">Try it</button>
​
<p id="demo"></p>
​
<script>
function myFunction() {
  var x = document.getElementById("myRadio").checked;
  document.getElementById("demo").innerHTML = x;
}
</script>
​
</body>
</html>
​
content_copyCOPY

https://www.w3schools.com/jsref/tryit.asp?filename