<!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>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter