Certified HTML5 Developer Learning Resources Text Input Control

Learning Resources
 

Text Input Control


Single-line text input controls:

Single-line text input controls are created using an element whose type attribute has a value of text.

Here is a basic example of a single-line text input used to take first name and last name:

First name:
Last name:

This will produce following result:

First name:
Last name:  

Following is the list of attributes for tag.

  • type: Indicates the type of input control you want to create. This element is also used to create other form controls such as radio buttons and checkboxes.

  • name: Used to give the name part of the name/value pair that is sent to the server, representing each form control and the value the user entered.

  • value: Provides an initial value for the text input control that the user will see when the form loads.

  • size: Allows you to specify the width of the text-input control in terms of characters.

  • maxlength: Allows you to specify the maximum number of characters a user can enter into the text box.

Password input controls::

This is also a form of single-line text input controls are created using an element whose type attribute has a value of password.

Here is a basic example of a single-line password input used to take user password:

Login :
Password:

This will produce following result:

Login :
Password :
 

Multiple-Line Text Input Controls:

If you want to allow a visitor to your site to enter more than one line of text, you should create a multiple-line text input control using the

This will produce following result:

Description :

Following is the detail of above used attributes for