Use If You Don’t Want Input Value Edited

Sharing is caring!

Attribute of
Input As The Fundamental Form Element In HTML: Here's What It Does
What does Use If You Don't Want Input Value Edited do?
Disallows the user from editing the value of the input.

Code Example

 <label for="favorite-animal">What is your favorite animal?</label><br>
 <input value="Flamingo" readonly>

readonly vs. disabled

The readonly and disabled attributes have superficially similar behaviors — they both stop the user from editing the value of the <input> element. However, there is a big difference. The value of the readonly element will be included when the form is submitted to the server. The value of a disabled element will not be submitted to the server.

Adam is a technical writer who specializes in developer documentation and tutorials.

Browser Support for readonly