Categories
JavaScript Answers

How to remove attribute checked from checkbox with JavaScript?

Spread the love

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.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.