<html>
<body>
<input type="radio" name="colors" value="red" id="myRadio">Red color
<p>Click the buttons below to display and/or change the value of the value attribute of the radio button.</p>
<button onclick="display()">Display name</button>
<button onclick="change()">Change name</button>
<script>
function display() {
var x = document.getElementById("myRadio").value;
alert("The value of the radio button is: " + x);
}
function change() {
var x = document.getElementById("myRadio").value = "newRadioBtnValue";
alert ("The value was changed to: " + x);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_radio_value2 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:17:19 GMT -->
</html>