Sometimes, we want to remove attribute checked from checkbox with JavaScript.
In this article, we’ll look at how to remove attribute checked from checkbox with JavaScript.
How to remove attribute checked from checkbox with JavaScript?
To remove attribute checked from checkbox with JavaScript, we use the removeAttribute
method.
For instance, we write
const audioCheckbox = document.getElementById("audioCheckbox");
audioCheckbox.removeAttribute("checked");
to get the checkbox with getElementById
.
Then we call removeAttribute
on the audioCheckbox
to remove the 'checked'
attribute.
Conclusion
To remove attribute checked from checkbox with JavaScript, we use the removeAttribute
method.