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

Adding a URL using the URL input type

Another of the many new input types that HTML5 supports is URL. How many times have you built a form using <input type="text" /> intending to collect a website 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 as well. Instead of:

<li>
<label for="website">Website</label>
<input id="website" name="website" type="text" class="required">
</li>

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

<li>
<label for="website">Website</label>
<input id="website" name="website" type="URL" class="required">
</li>

Like <input type="email" /> visually, ...

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