Use email input to collect email address

Description

The email type value configure the input element to accept only input that is a valid e-mail address.

It supports the additional attributes shown in the following list.

  • list - Sets the id of a datalist element that provides values for the element.
  • maxlength - Specifies the maximum length that the user can enter into the text box.
  • pattern - Specifies a regular expression pattern for input validation.
  • placeholder - Specifies a hint to the user.
  • readonly - If present, make the text box read-only.
  • required - Specifies that the user must provide a value.
  • size - Specifies the width of the element.
  • value - Specifies the initial value for the element. For the email type, this can be a single address, or multiple addresses separated by commas.

The email type also supports the multiple attribute which, when applied, allows the input element to accept multiple e-mail addresses.

Example


<!DOCTYPE HTML>
<html>
<body>
  <form method="post" action="http://example.com/form">
    <p>
      <label for="email"> Email: <input type="email"
        placeholder="user@domain.com" id="email" name="email" />
      </label>
    </p><!--   w w w. j  a  v a 2  s .  c o  m-->
    <input type="submit" value="Submit Vote" />
  </form>
</body>
</html>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed