Wednesday 5 April 2017

INPUT Element in HTML

INPUT Element:-It is an empty element specified by <INPUT> tag. It is used to provide an input field in a form where the user can enter the data. An input field may be a textfield, a checkbox, a radio button, a button, and more. INPUT element is always used within the FORM element. Thus, INPUT element defines an object on the FORM which can receive user input.

Syntax:
 <INPUT TYPE="FieldType" NAME="FieldName" VALUE="FieldText">


Attributes of INPUT element:

TYPE:The TYPE attribute determines the field type of input field to be provided in the form. Field type can be one of the following:
TEXT, PASSWORD, RADIO, CHECKBOX, SUBMIT, RESET, BUTTON, IMAGE, HIDDEN, FILE.


Syntax:
TYPE = "FieldType"

NAME:Specifies the name of the field. This name does not appear on the FORM. It is required for the identification/ differentiation as there can be more than one fields in a single FORM.

Syntax:
NAME = "FieldName"

VALUE:Specifies the text to be displayed on the field.

Syntax:
VALUE = "FieldText"




Values of TYPE attribute:

TEXT:It provides a single line text input field where the user can enter text.

PASSWORD:It provides a single line text input field where the user can enter password. A password field is different from a text field because a text field displays whatever characters are entered by the user whereas a password field shows one dot for each character input by the user. This is to prevent
others from seeing the password.

RADIO:It provides a radio button on the form.

CHECKBOX:It provides a check box on the form.

SUBMIT:This provides a button on the form. When this button is clicked, the form is submitted to the destination.

RESET:This provides a button on the form. When this button is clicked, the input fields on the form are reset to their default state.

No comments:

Post a Comment