Input Email disabled
Attribute
Example
Disable the email field:
document.getElementById("myEmail").disabled = true;
Output result:
Definition and Usage
The disabled
attribute is used to set or return whether the email field is disabled.
Elements with the disabled
attribute are unusable and unclickable. Disabled elements are typically displayed in a grayed-out state in the browser.
This attribute reflects the HTML disabled
attribute.
Browser Support
All major browsers support the disabled
attribute.
Note: Internet Explorer 9 (and earlier versions) or Safari do not support the HTML <input>
element with type="email"
.
Syntax
Return the disabled
attribute:
Set the disabled
attribute:
Attribute Values
Value | Description |
---|---|
true|false | Describes whether the email field is usable. true - The email field is unusable<br>false - Default. The email field is usable |
Technical Details
| Return Value: | Boolean, returns true if the email field is unusable, otherwise returns false | | --- | --- |
More Examples
Example
Check if the email field is usable:
var x = document.getElementById("myEmail").disabled;
true
Example
Disable or enable the email field:
function disableBtn() { document.getElementById("myEmail").disabled = true;
}
function undisableBtn() { document.getElementById("myEmail").disabled = false;
}
Related Pages
HTML Reference: HTML <input> disabled Attribute