By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

HTML Input Tag

The Input element is used for user-input in forms.

Edited: 2014-12-28 07:02

The HTML Input element is used togetter with form elements, to accept user contributed data. Usually a server-side script handles the submitted data.


You should not rely on client-side ways of validating forms, or restrict the forms. Additional server-side validation will need to take place for security reasons.


Standard Attributes

AttrsOther AttributesCommon, I18n, EventSTF
typeInputTypeThe Type of the Input element.STF
nameCharacter DataUnique name of the input, submitted as a part of the form.STF
valueCharacter DataSpecify for radio buttons and checkboxes.STF
checkedcheckedFor radio buttons and check boxes.STF
disableddisabledFor radio buttons and check boxes.STF
sizeCharacter DataSpecific to each type of field.STF
readonlyreadonlyfor text and passwords.STF
maxlengthNUMBERMax Characters for text-fields.STF
srcURIFor fields with images.STF
altCharacter DataShort Description.STF
usemapURIUse client-side image map.STF
ismapismapUse server-side image map.STF
tabindexNUMBERPosition in tabbing order.STF
accesskey{CHARACTER}key used for accessibility.STF
onfocusSCRIPTThe element got the focus.STF
onblurSCRIPTThe element lost the focus.STF
onselectSCRIPTSome text was selected.STF
onchangeSCRIPTThe element value was changed.STF
acceptContentTypesList of MIME types for file upload.STF

DTD. Defines which document type the attribute is allowed. S=Strict, T=Transitional, F=Frameset.


The Simple Example.

<input type="text" name="name">


The Full Example.

<form action="action.php" method="post">
 <input type="text" name="name">
 <input type="text" name="email">
 <textarea cols="40" rows="5" name="textmsg"></textarea>
 <input type="submit" value="Submit">

The full example was included to save you the time required to look up each reference entry.