How to prevent users from typing in a text field without disabling the field with HTML?

Spread the love

To prevent users from typing in a text field without disabling the field with HTML, we add the readonly attribute.

For instance, we write

<input readonly type="text" />

to add the readonly attribute to the input to stop users from enter input values but not make it grayed out.

Leave a Reply

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