How to make a text input non-editable with HTML?

Spread the love

Sometimes, we want to make a text input non-editable with HTML.

In this article, we’ll look at how to make a text input non-editable with HTML.

How to make a text input non-editable with HTML?

To make a text input non-editable with HTML, we can set the readonly attribute.

For instance, we write

<input type="text" value="3" class="field left" readonly="readonly" />

to set the readonly`` attribute to readonly` on the input to stop users from editing its value.

Conclusion

To make a text input non-editable with HTML, we can set the readonly attribute.

Leave a Reply

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