Input Email readOnly property
Example
Set the email field to read-only:
document.getElementById("myEmail").readOnly = true;
Output result:
Try it »
Definition and Usage
The readOnly property is used to set or return whether the email field is read-only.
A read-only field cannot be modified. However, its content can be copied.
This attribute reflects the HTML readonly attribute.
**Tip:** To ensure the accuracy of form data, you can use disabled the attribute instead.
Browser support





All major browsers support the readOnly attribute.
Note: Internet Explorer 9 (and earlier IE versions) or Safari browser does not support the HTML element with type="email". .
Syntax
Return the readOnly attribute:
emailObject
.readOnly
Set the readOnly attribute:
emailObject
.readOnly=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the email field is read-only
|
Technical Details
| Return Value: | Boolean, returns true if the email field is read-only, otherwise returns false. |
|---|
More examples
Example
Check whether the email field is read-only:
var x = document.getElementById("myEmail").readOnly;
x
The output is:
true
Try it »
Related pages
HTML Reference Manual: HTML readonly attribute
Input Email Object