The type attribute is used to define what sort of type an input or ordered list element is.
Applies to [HTMLInputElement](/html/elements/input) [OLElement](/html/elements/ol)In general the type attribute is used for \
and for \ elements. As with HTML5 the attribute is no longer deprecated for \ elements. <input>The type attribute specifies the type of an <input> element to display. There are several possible types like text, button or submit.
The default type for an <input> element is: text. The attribute is not required, but it is recommended to include the attribute to prevent misunderstandings.
An input element with a type attribute whose value is:
For <ol> elements the type attribute is used to specify the kind of marker to use in the list.
As default the list will be marked with decimal numbers (1, 2, 3, …).
Possible attribute values are the following:
Type attributes used in a form.
<code>
<form>
Text: <input type="text" name="textInput"> <br/>
<br/>
Color: <input type="color" value="#ff0000" name="colorInput"/> <br/>
Date: <input type="date" value="2013-09-03" name="dateInput"> <br/>
Datetime: <input type="datetime" name="datetimeInput"> <br/>
Datetime-local: <input type="datetime-local" value="2013-09-03T20:00" name="datetime-local"> <br/>
Email: <input type="email" name="emailInput"> <br/>
File: <input type="file" name="fileInput"> <br/>
Hidden: <input type="hidden" name="hiddenInput"> <br/>
Month: <input type="month" value="2013-09" name="monthInput"> <br/>
Number: <input type="number" name="numberInput"> <br/>
Password: <input type="password" name="passwordInput"> <br/>
Checkbox: <input type="checkbox" name="checkboxInput" id="checkboxId1" checked><label for="checkboxId1">label 1</label>
<input type="checkbox" name="checkboxInput" id="checkboxId2"><label for="checkboxId2">label 2</label> <br/>
Radio: <input type=radio name="radioInput" id="radioId1" checked><label for="radioId1">label 1</label>
<input type=radio name="radioInput" id="radioId2"><label for="radioId2">label 2</label> <br/>
Range: <input type="range" name="rangeInput"> <br/>
Search: <input type="search" name="searchInput"> <br/>
Tel: <input type="tel" name="telInput"> <br/>
Time: <input type="time" name="timeInput"> <br/>
Url: <input type="url" name="urlInput"> <br/>
Week: <input type="week" name="weekInput"> <br/>
<br/>
Image: <input type="image" name="imageInput"> <br/>
Button: <input type="button" value="Button" onclick="alert('This is a javascript alert')"> <br/>
Reset: <input type="reset" value="Reset"> <br/>
<br />
Submit: <input type="submit" value="Submit"> <br/>
</form>
</code>
Type attribute for lowercase, roman numbering used in an ordered list.
<ol type="i">
<li>First list item</li>
<li>Second list item</li>
<li>Third list item</li>
<li>Forth list item</li>
<li>Fifth list item</li>
</li>
Notes Remarks
Only the type property is writeable. The type property is read/write-once, but only when an input element is created with the createElement method and before it is added to the document.
Syntax Standards informationinput type=button
input type=checkbox
input type=file
input type=hidden
input type=image
input type=password
input type=radio
input type=reset
input type=submit
input type=text
Microsoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4