Use If You Don't Want Input Value Edited
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
- Attribute of
- How To Use Input To Create Form Fields In HTML: Easy Tutorial
- What does
Use If You Don't Want Input Value Editeddo?
- Disallows the user from editing the value of the input.
<form> <label for="favorite-animal">What is your favorite animal?</label><br> <input value="Flamingo" readonly> </form>
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.
Browser Support for readonly