HTML DOM Input Email disabled Property
Example
Disable the email field:
document.getElementById("myEmail").disabled = true;
Output:
Definition and Usage
The disabled property sets or returns whether an email field should be disabled, or not.
A disabled field is unusable and un-clickable. Disabled fields are usually displayed in grey.
The property reflects the HTML disabled attribute.
Browser Support
The disabled property is supported in all major browsers.
Note: Internet Explorer 9 (and earlier) or Safari does not support the HTML <input> element with type="email".
Syntax
Return the disabled property:
emailObject.disabled
Set the disabled property:
emailObject.disabled=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Specifies whether the email field should be disabled or not.
|
Technical Details
| Return Value: | A Boolean. Returns true if the email field is disabled, otherwise it returns false |
|---|
More Examples
Example
Check if the email field is disabled:
var x = document.getElementById("myEmail").disabled;
x will be:
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
YouTip