Computer >> Máy Tính >  >> Lập trình >> HTML

HTML DOM Input Email nhiều Thuộc tính

HTML DOM Input Email nhiều thuộc tính trả về / bộ nếu Email đầu vào có chấp nhận nhiều email hay không.

Cú pháp

Sau đây là cú pháp -

  • Trả lại tham chiếu cho nhiều đối tượng
inputEmailObject.multiple
  • Đặt nhiều thuộc tính boolValue
inputEmailObject.multiple = boolValue

Giá trị Boolean

Đây, “booleanValue” có thể như sau -

booleanValue Chi tiết
true Nó xác định rằng email đầu vào chấp nhận nhiều mục nhập.
sai Nó xác định rằng email đầu vào không chấp nhận nhiều email và nó cũng là giá trị mặc định.

Ví dụ

Hãy để chúng tôi xem ví dụ về Nhập nhiều Email tài sản -

<!DOCTYPE html>
<html>
<head>
<title>Input Email multiple</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-multiple</legend>
<label for="EmailSelect">Employee Email :
<input type="email" id="EmailSelect" placeholder="jkl@qwerty.com">
</label>
<input type="button" onclick="changeToMultiple()" value="Enable Multiple Emails">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputEmail = document.getElementById("EmailSelect");
   divDisplay.textContent = 'Multiple Emails Allowed: '+inputEmail.multiple;
   function changeToMultiple() {
      inputEmail.multiple = true;
      divDisplay.textContent = 'Multiple Emails Allowed: '+inputEmail.multiple;
   }
</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 -

HTML DOM Input Email nhiều Thuộc tính

Sau khi chọn ‘Xác nhận Email’ nút -

HTML DOM Input Email nhiều Thuộc tính