Thuộc tính HTML DOM Input Email bị vô hiệu hóa sẽ thiết lập / trả về liệu Email nhập được bật hay tắt.
Cú pháp
Sau đây là cú pháp -
- Trả về giá trị boolean - true / false
inputEmailObject.disabled
- Đã tắt cài đặt thành booleanValue
inputEmailObject.disabled = booleanValue
Giá trị Boolean
Đây, “booleanValue” có thể như sau -
| booleanValue | Chi tiết |
|---|---|
| true | Nó xác định rằng email đầu vào bị vô hiệu hóa. |
| sai | Nó xác định rằng email đầu vào không bị tắt và nó cũng là giá trị mặc định. |
Ví dụ
Hãy để chúng tôi xem ví dụ về Email nhập bị tắt tài sản -
<!DOCTYPE html>
<html>
<head>
<title>Input Email disabled</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form>
<fieldset>
<legend>Email-disabled</legend>
<label for="EmailSelect">Employee Email :
<input type="email" id="EmailSelect" value="xyz@abc.com">
</label>
<input type="button" onclick="getdisabled()" value="Confirm Email">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputEmail = document.getElementById("EmailSelect");
function getdisabled() {
inputEmail.disabled = true;
divDisplay.textContent = 'Email: '+inputEmail.value+' submitted.';
}
</script>
</body>
</html> Đầu ra
Điều này sẽ tạo ra kết quả sau -
Trước khi nhấp vào ‘Xác nhận Email’ nút -
Sau khi nhấp vào ‘Xác nhận Email’ nút -