How to set HTML checkboxes to readonly?

Spread the love

Sometimes, we want to set HTML checkboxes to readonly.

In this article, we’ll look at how to set HTML checkboxes to readonly.

How to set HTML checkboxes to readonly?

To set HTML checkboxes to readonly, we add the disabled attribute.

For instance, we write

<input type="checkbox" disabled="disabled" checked="checked" />

to add a checkbox with the disabled attribute set to disabled to disable it.

Conclusion

To set HTML checkboxes to readonly, we add the disabled attribute.

Leave a Reply

Your email address will not be published. Required fields are marked *