Javascript Reference - HTML DOM Input Email multiple Property








The multiple property sets or gets whether an email field can accept multiple emails on form submission.

Browser Support

multiple Yes 10.0 Yes Yes Yes

Syntax

Return the multiple property.

var v = emailObject.multiple

Set the multiple property.

var v = emailObject.multiple=true|false

Property Values

Value Description
true|false Set whether an email field should accept multiple emails on form submission
  • true - The email field accept multiple emails
  • false - Default. The email field does not accept multiple emails




Return Value

A Boolean type value, true if the email field accept multiple emails, otherwise false.

Example

The following code shows how to set an email field to allow multiple emails.


<!DOCTYPE html>
<html>
<body>
<!--from  w w w .j av a2s  .  c o m-->
<form action="url">
  E-mail: <input type="email" id="myEmail" name="usremail">
  <input type="submit">
</form>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
    document.getElementById("myEmail").multiple = true;
}
</script>

</body>
</html>

The code above is rendered as follows:





Example 2

The following code shows how to get if an email field accept multiple emails.


<!DOCTYPE html>
<html>
<body>
<!--from  w  ww .  j  a v  a 2s.  c o  m-->
<form action="url">
  E-mail: <input type="email" id="myEmail" name="usremail" multiple>
  <input type="submit">
</form>
<button onclick="myFunction()">test</button>
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myEmail").multiple;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: