The input element is used to create form inputs that allow a user to
enter information on a web page and then submit this information to
the server. There are many different types of input elements that you can
use to compose a web form. Understanding each type is important to
create usable forms.
The button input is used to create a push button on the screen. These
buttons do nothing on their own. However, when you attach an event using
the onclick handler, you can make a button perform custom actions including
but not limited to a form post action.
The checkbox input creates a checkbox that may be checked or unchecked. In
the checked state, the checkbox will pass the value specified by the value
attribute. In the unchecked state, the checkbox passes no value.
If you create multiple checkboxes with the same name, the form will pass an array
of values for the name specified. The passed form values should be handled using
A hidden input is used to pass a form value without displaying any visible
form input on the screen. This is useful for passing parameters from one
page to the next. It is a good alternative to passing values in the query string
component of the URL since it hides the parameter from the user.
A radio button input displays a button with a label next to it. If the button is
marked with a black circle, its value is passed to the server. If the button is cleared
the value will not be passed.
If you create multiple radio buttons with the same name, the form will only allow one
button to be selected at a time. We say that the options are mutually exclusive because
only one can be chosen from the group at any time. In this scenario, we are guaranteed
that only one value gets passed for the input name.
A reset input is a special type of push button which allows a user to reset all of the
form values to their initial state. Although this input initially seemed useful, it
has been more of a nuisance than a help. This is because users might accidently hit the
reset button after taking all of the time to fill out a long form. We don't advise
using this element on your web forms.
A submit input is a special type of push button which allows a user to submit a form
event. If the onclick method returns a value of false, the form submit will be canceled.
This allows a programmer to do special form validation before a form is submitted.
<TEXTAREA> and <SELECT>
Two other inputs that are covered elsewhere are the TEXTAREA
and SELECT input. These create a multi-line text box and
a selection list respectively.
Identifies this tag to reference in script (program code)
Define the class used to render this element (defined by a style sheet)
A title that is associated with the element (displayed as a tooltip in Internet Explorer)
Defines the name that will be used to reference this element in the Document Object Model (DOM)
Must be defined as BUTTON for this type of input
Defines the label which is affixed to the button and is displayed to the user
Presence of this attributes indicates the button cannot be clicked
Indicates the "tab order" for keyboard navigation of the web page input controls