Home → References → HTML Tags →
HTML Tag: input
A form element that can be represented as a text box, password text box, check box, radio button, submit button, reset button, hidden input field, image (which acts as a submit button), file selection box or general button.
HTML Dog is hosted by Titan Internet
Required Attributes
- None.
Optional Attributes
namecan be used so that the value of the element can be processed.typecan be used to specify the type of input. Values can betext(default),password,checkbox,radio,submit,reset,hidden,image,fileorbutton.valuecan be used to specify the initial value. It is required when type is set tocheckboxorradio. It should not be used when type is set tofile.checkedcan be used whentypeis set tocheckboxorradioto set the initial state of a check box or radio button to be selected. It must be used in the formatchecked="checked".maxlengthcan be used to specify the maximum number of characters allowed in a text box.srccan be used whentypeis set toimageto specify the location of an image file.altcan be used whentypeis set toimageto specify the alternative text of the image, which should be a short description.acceptcan be used whentypeis set tofileto specify which file-types should be accepted. This is a comma-separated list of MIME types.disabledcan be used to disable an element. It must be used in the formatdisabled="disabled".readonlycan be used to specify that the value of the element can not be changed. It must be used in the formatreadonly="readonly".accesskeycan be used to associate a keyboard shortcut to the element.tabindexcan be used to specify where the element appears in the tab order of the page.- Common attributes
Example
<form action="somescript.php" />
<p>Do you like pie?</p>
<div>yes <input type="radio" name="pie" value="yes" checked="checked" /></div>
<div>no <input type="radio" name="pie" value="no" /></div>
<div>Your name: <input type="text" name="name" /></div>
<div><input type="image" name="submitimage" src="someimage.gif" /></div>
</form>

