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:
|
This will produce following result:
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:
|
This will produce following result:
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
Here is a basic example of a multi-line text input used to take item description:
|
This will produce following result:
Following is the detail of above used attributes for
-
name: The name of the control. This is used in the name/value pair that is sent to the server.
-
rows: Indicates the number of rows of text area box.
-
cols: Indicates the number of columns of text area box.