HTML <input> readonly Attribute
HTML <input> tag
Example
An HTML form with two input fields (one read-only) and one submit button:
<form
action="form_action.asp"
method="get">
Email:
<input type="text" name="email" /><br />
Country:
<input type="text" name="country" value="Norway"
readonly="readonly" /><br />
<input type="submit" value="Submit" />
</form> |
Try it yourself »
|
Definition and Usage
The readonly attribute specifies that an input field should be read-only.
A read-only field cannot be modified. However, a user can tab to it, highlight it, and copy the text from it.
The readonly attribute can be set to keep a user from changing the value until some other condition has been met (like selecting a
checkbox, etc.). Then, a JavaScript is required to remove the readonly value, and make the input field editable.
The readonly attribute can be used with <input type="text"> or <input type="password">.
Browser Support

The readonly attribute is supported in all major browsers.
Syntax
| <input readonly="value" /> |
Attribute Values
| Value |
Description |
| readonly |
Specifies that an input field is read-only |
HTML <input> tag
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|