Book Image

HTML5 Data and Services Cookbook

Book Image

HTML5 Data and Services Cookbook

Overview of this book

HTML5 is everywhere. From PCs to tablets to smartphones and even TVs, the web is the most ubiquitous application platform and information medium bar. Its becoming a first class citizen in established operating systems such as Microsoft Windows 8 as well as the primary platform of new operating systems such as Google Chrome OS. "HTML5 Data and Services Cookbook" contains over 100 recipes explaining how to utilize modern features and techniques when building websites or web applications. This book will help you to explore the full power of HTML5 - from number rounding to advanced graphics to real-time data binding. "HTML5 Data and Services Cookbook" starts with the display of text and related data. Then you will be guided through graphs and animated visualizations followed by input and input controls. Data serialization, validation and communication with the server as well as modern frameworks with advanced features like automatic data binding and server communication will also be covered in detail.This book covers a fast track into new libraries and features that are part of HTML5!
Table of Contents (21 chapters)
HTML5 Data and Services Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using the text input field


We will take a look at one of the basic examples of using input data with HTML <input type="text">. This input type automatically removes line breaks from the input values, so it's intended for single line text usage as shown in the following screenshot:

How to do it...

In the body section of the HTML document, we will create a form where the inputs with type text will be placed:

  1. First we add the most basic input type text:

    <form>
      <p>
        First name  <input name="firstname" type="text">
      </p>
  2. Following that, we add one where audio input will be enabled:

      <p>
        Speak up <input name="quote" type="text" x-webkit-speech speech>
      </p>
  3. Also add one with the placeholder attribute and one with the autofocus attribute:

      <p>
        Last name: <input name="lastname" type="text" placeholder="John Doe">
      </p>
      <label>
        Comment <input name="comment" type="text" title="This is area to insert your opinion...