O'Reilly logo

HTML5 Multimedia Development Cookbook by Lee Jordan, Dale Cruse

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the e-mail input type

One of the many new input types that HTML5 supports is email. How many times have you built a form using <input type="text" /> intending to collect an e-mail address? Now we can use something much more semantically correct! Later, we'll see how this supports form validation as well.

How to do it...

The previous FoundationSix example could be easily converted to this new input type. Instead of:

<li>
<label for="email">Email</label>
<input id="email" name="email" type="text" class="required email">
</li>

We could simply change the input type and end up with:

<li>
<label for="email">Email</label>
<input id="email" name="email" type="email" class="required email">
</li>

Visually, the <input type="email" /> tag looks identical ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required