Input Email multiple Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Email field

Description

The multiple property sets or gets whether an email field should accept multiple emails.

This property reflects the HTML multiple attribute.

Set the multiple property with the following Values

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

Return Value

A Boolean, returns true if the email field accept multiple emails, otherwise it returns false

The following code shows how to check if an email field accept multiple values/emails:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

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

Related Tutorials