In this article, we will discuss how to unchecked a radio button using JavaScript.
To unchecked a radio button, we can use the JavaScript checked property.
Syntax #
myRadio.checked = false;
The checked property Specifies whether a checkbox should be checked or not.
true - The checkbox is checked.
false - The checkbox is not checked (default).
false - The checkbox is not checked (default).
Click on the button to open the code in our online editor.
<input id="radio" type="radio" checked>
<button onclick="myFunction()">
Uncheck
</button>
<script>
function myFunction() {
const radioButton = document.querySelector('#radio');
radioButton.checked = false;
}
</script>
Comments (0)