Edit This Code:
<!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>


Result:
Try it Yourself - © w3schools.com
Privacy Policy