HTML DOM Input Email Multiple Property



The HTML DOM Input Email multiple property returns/sets if input Email should accept multiple emails or not.

Syntax

Following is the syntax −

  • Returning reference to the multiple object
inputEmailObject.multiple
  • Set multiple property to boolValue
inputEmailObject.multiple = boolValue

Boolean Values

Here, “booleanValue” can be the following −

booleanValue Details
true It defines that the input email accepts multiple entries.
false It defines that the input email is not accepying multiple emails and it is also the default value.

Example

Let us see an example of Input Email multiple property −

 Live Demo

<!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="[email protected]">
</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>

Output

This will produce the following output −

Before clicking ‘Confirm Email’ button −

After checking ‘Confirm Email’ button −

Updated on: 2019-07-30T22:30:26+05:30

176 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements