What is the HTML5 email form field input?

In HTML5, there is a new type that is specifically for email inputs on a form. The markup <input type=”email”> basically tells the browser that it should not allow the form to be submitted if the user has not entered what the browser determines to be a correctly formatted email address.

Remember that the browser must do the validation – HTML5 is just a standard that means nothing until the browser actually implements it. Also, this doesn’t mean that the browser is supposed to actually check to see if the email address is a real email address (that would be very difficult to do), but only that it’s format is valid (like it contains an “@” sign, etc.).

Empty email form field inputs

Just like any other input type, a user can submit a form with an empty email input field – unless of course there is a “required” attribute for the input field.

The email input and “multiple” attribute

The HTML5 email input type can also have what’s known as the multiple attribute, which, when used inside an input tag with type “email”, basically means that the value of the field can be a list of comma-separated, valid email addresses. This would just look something like this: <input type=”email” multiple>. But, this functionality doesn’t mean that the user has to put in a comma separated list manually. The browser could possibly offer some suggestions for which emails to add to the input field – through a contacts list stored somewhere – the point is that it’s up to the browser to display other options to the user in this scenario.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.