Javascript DOM HTML Input Email multiple Property

Introduction

Find out if an email field accept multiple values/emails:

var x = document.getElementById("myEmail").multiple;

Click the "Test" button to find out if the email field accept multiple values (emails).

View in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php">
  E-mail: <input type="email" id="myEmail" name="usremail" multiple>
  <input type="submit">
</form>/*from  www .j  a  v a 2  s  . c o  m*/

<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 multiple property sets or gets whether an email field should accept multiple emails.

This property mirrors the HTML multiple attribute.

The multiple property accepts and returns a boolean value.

Property Values

Value Description
true The email field accept multiple emails
false Default. The email field does not accept multiple emails

The multiple property returns returns true if the email field accept multiple emails, otherwise it returns false.




PreviousNext

Related