Latest

recent

HTML Input readonly Attribute

Definition and Usage

The readonly attribute specifies that the input field is read only (un-editable).
This attribute allows the user to highlight and copy the text inside the input field, but not change the value.
This attribute is often used together with a JavaScript to keep the user from editing a field before a specific task (lie clicking a button button or selecting checkbox) is completed.
This attribute is only used if the type attribute of the input element is set to "text" or "password".

Syntax

<input readonly="readonly" />

Attribute Values

Value Description
readonly Specifies that the text or password field is read-only.


Browser Support


The attribute is supported in all major browsers.

Example

<form action="">
<input type="text" name="demo" readonly="readonly" />
</form>
HTML Input readonly Attribute Reviewed by 1000sourcecodes on 04:05 Rating: 5
Powered by Blogger.