chapter six

Enhancing Your Web Forms with HTML5

In Chapter 5 you learned how to create web forms using elements such as <form>, <input>, <select>, and <option>. In this chapter you are going to learn how you can make your forms more delightful for users by taking advantage of the new range of input types and attributes that have been introduced in HTML5.

For example, the new datetime input types enable you to display a small calendar to the user when you need to collect a date. This makes it much easier for the user, as she can simply click on a date in the calendar instead of needing to manually type the date into a text field. The new <datalist> element enables you to easily create autocomplete lists similar to those that you see when you type a query into the search box on Google. This makes things much easier for users as it reduces the amount that they need to type. In this chapter you will learn how to use both of these new features as well as a lot of other fantastic HTML5 additions.

It is important to note that the input types and attributes that you will be learning about in this chapter are not yet widely supported. If a browser does not support an input type, then the text type will be used. If an attribute is not supported it will simply be ignored.

Get HTML5 Foundations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.