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

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file, Excel 2007, XBRL, or Web services data.
Then it transforms data instantly or auto-generates royalty-free data integration code for recurrent conversions.
Download a free, fully functional 30-day trial to experience the following features:
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
Download a fully-functional trial today!
|
|
|
|