References
Collection of references for web development.
HTML input tag
Description
The HTML <input> element is used to create controls for forms, it allows the user to input data and optionally submit to a server.
Attributes
Attribute | Value | Description |
accept | file_extension mime_type audio/* video/* image/* |
Specifies the type of file the server accepts. |
autocomplete | on off |
Specifies if form elements should be automatically completed by the browser. |
autofocus | boolean | Specifies if the element should automatically have focus when the document loads. |
capture | boolean | Specifies if the control should use capture for media devices. |
checked | boolean | Specifies the check state of the element, default is checked or else ignore. |
disabled | boolean | Specifies whether the element should be disabled or not (user is unable to click or control if disabled). |
form | ID | Specifies the form(s) that the element belongs to. |
formaction | URL | Specifies where to send the data. |
formenctype | application/x-www-form-urlencoded multipart/form-data text/plain |
Specifies what type of content is used when submitting the data. Type=submit only! |
formmethod | post get |
Specifies what method to use when submitting the data. Type=submit only! |
formnovalidate | boolean | Specifies that the data should not be validated on submit. Type=submit only! |
formtarget | _self _blank _parent _top framename |
Specifies where to display the response that is received after submitting the data. Type=submit only! |
height | number | Specifies the height of the element, default is measured in pixels. |
list | datalist_id | Specifies a pre-defined list of suggestions to the user. |
max | number | Specifies the maximum value for this element. |
maxlength | number | Specifies the maximum number of characters a user can enter. |
min | number | Specifies the minimum value for this element. |
minlength | number | Specifies the minimum number of characters a user can enter. |
multiple | boolean | Specifies whether the user can enter more than one value. |
name | string | Specifies the name of the element. |
pattern | regex | Specifies the regular expression that the element is checked against. |
placeholder | string | Specifies a hint that describes the expected value. |
readonly | readonly | Specifies if the user can modify the element. |
required | required | Specifies that the elements value is required before submitting the form. |
selectionDirection | forward backward none |
Specifies the selection direction. |
selectionEnd | number | Specifies the offset of the last selected character. |
selectionStart | number | Specifies the offset of the first selected character. |
size | size | Specifies the size of the element. |
spellcheck | boolean | Specifies if the elements value should have its spelling and grammar checked. |
src | URL | The URL of the file to embed in the document. |
step | number | Specifies the intervals for the min and max attributes. |
tabindex | number | Specifies the position of the navigation tabbing in the document. |
type | button checkbox color date datetime-local file hidden image month number password radio range reset search submit tel text time url week |
Specifies the type of the input control. |
value | value | Specifies the value of the element. |
width | number | Specifies the width of the element, default is measured in pixels. |
Example
<form>
<input type="text" name="username" placeholder="Username"><br>
<input type="password" name="password" placeholder="Password"><br>
<label for="rememberme">Remember Me?</label>
<input type="checkbox" name="rememberme" id="rememberme"><br>
<input type="submit" name="submitinfo">
</form>
More Examples
<!-->
<!DOCTYPE>
<a>
<abbr>
<address>
<area>
<article>
<aside>
<audio>
<b>
<base>
<bdi>
<bdo>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<cite>
<code>
<col>
<colgroup>
<data>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<footer>
<form>
<h1>
<h2>
<h3>
<h4>
<h5>
<h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<meta>
<meter>
<nav>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<picture>
<pre>
<progress>
<q>
<rp>
<rt>
<rtc>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<template>
<textarea>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<u>
<ul>
<var>
<video>
<wbr>
accept
accept-charset
action
allowfullscreen
alt
as
async
autocomplete
autofocus
autoplay
buffered
capture
charset
checked
cite (attr)
cols
colspan
content
controls
coords
crossorigin
data (object)
datetime
decoding
default
defer
dir
disabled
download
enctype
for
form (attr)
formaction
formenctype
formmethod
formnovalidate
formtarget
headers
height
high
href
hreflang
http-equiv
integrity
ismap
kind
label (attr)
label (track)
list
longdesc
loop
low
max
maxlength
media
method
min
minlength
multiple
muted
name
name (meta)
nonce
novalidate
open
optimum
pattern
ping
placeholder
played
playsinline
poster
preload
readonly
rel
required
reversed
rows
rowspan
sandbox
scope
selected
selectionDirection
selectionEnd
selectionStart
shape
size
sizes
span (col)
src
srcdoc
srclang
srcset
start
step
target
text
type
type (button)
type (input)
type (list)
type (object)
typemustmatch
usemap
value
volume
width
wrap
xmlns
onabort
onafterprint
onanimationcancel
onanimationend
onanimationiteration
onbeforeprint
onbeforeunload
onblur
oncanplay
oncanplaythrough
onchange
onclick
oncontextmenu
oncopy
oncuechange
oncut
ondblclick
ondrag
ondragend
ondragenter
ondragleave
ondragover
ondragstart
ondrop
ondurationchange
onemptied
onended
onerror
onfocus
onhashchange
oninput
oninvalid
onkeydown
onkeypress
onkeyup
onload
onloadeddata
onloadedmetadata
onloadstart
onmessage
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
onoffline
ononline
onpagehide
onpageshow
onpaste
onpause
onplay
onplaying
onpopstate
onprogress
onratechange
onredo
onreset
onresize
onscroll
onsearch
onseeked
onseeking
onselect
onstalled
onstorage
onsubmit
onsuspend
ontimeupdate
ontoggle
ontouchcancel
ontouchmove
ontouchstart
ontransitioncancel
ontransitionend
onundo
onunload
onvolumechange
onwaiting
onwheel