Sometimes, we want to clear radio button in JavaScript.
In this article, we’ll look at how to clear radio button in JavaScript.
How to clear radio button in JavaScript?
To clear radio button in JavaScript, we set its checked
property to false
.
For instance, we write
document.querySelector('input[name="Choose"]:checked').checked = false;
to select the checkbox we want to uncheck with querySelector
.
And then we set its checked
property to false
to clear it.
Conclusion
To clear radio button in JavaScript, we set its checked
property to false
.