The disabled
property disables or enables an email field.
disabled |
Yes | 10.0 | Yes | Yes | Yes |
Return the disabled property.
var v = emailObject.disabled
Set the disabled property.
emailObject.disabled=true|false
Value | Description |
---|---|
true|false | Disable or enable an email field
|
A Boolean type value, true if the email field is disabled, otherwise false.
The following code shows how to get if an email field is disabled.
<!DOCTYPE html>
<html>
<body>
<!--from w w w.j a v a 2 s . c om-->
E-mail: <input type="email" id="myEmail" disabled>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myEmail").disabled;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to disable and enable an email field.
<!DOCTYPE html>
<html>
<body>
<!-- w ww . j a va 2 s . c om-->
E-mail: <input type="email" id="myEmail"><br><br>
<button onclick="disableBtn()">Disable Email Field</button>
<button onclick="enableBtn()">Enable Email Field</button>
<script>
function disableBtn() {
document.getElementById("myEmail").disabled = true;
}
function enableBtn() {
document.getElementById("myEmail").disabled = false;
}
</script>
</body>
</html>
The code above is rendered as follows: