HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

input

Description

The input element for HTML represents a typed data field, usually with a form control to allow the user to edit the data.

Syntax

HTML

<input attribute-name="attribute-value"></input>

Attributes

Global

NameValueDescription
acceptmime-type listProvides the UA with a hint of what file types the server is able to accept
altnormal character datafallback content for the image map
autocompleteon | offSpecifies whether the element represents an input control for which a UA is meant to store the value entered by the user (so that the UA can prefill the form later)
autofocusautofocus | emptySpecifies that the element represents a control to which a UA is meant to give focus as soon as the document is loaded
checkedchecked | emptySpecifies that the element represents a selected control
disableddisabled | emptySpecifies that the element represents a disabled control
formIDREFIdentifies a form with which to associate the element
formactionURIForm-submission action for the element
formenctypeapplication/x-www-form-urlencoded | multipart/form-data | text/plainMIME type with which a UA is meant to associate this element for form submission
formmethodget | post | put | deleteHTTP method with which a UA is meant to associate this element for form submission
formnovalidateformnovalidate | emptySpecifies that the element represents a control whose value is not meant to be validated during form submission
formtargetbrowsing-context name or keywordBrowsing context or keyword that represents the target of the control
heightnon-negative integerVertical dimension
listIDREFIdentifies a datalist with which to associate the element
maxdate-time | local date-time | date | month | time | week | floatExpected upper bound for the element's value
maxlengthpositive integerMaximum length of value
mindate-time | local date-time | date | month | time | week | floatExpected lower bound for the element's value
multiplemultiple | emptySpecifies that the element allows multiple values
namestringName part of the name/value pair associated with this element for the purposes of form submission
patternpatternSpecifies a regular expression against which a UA is meant to check the value of the control represented by its element
placeholderstringShort hint (one word or a short phrase) intended to aid the user when entering data into the control represented by its element
readonlyreadonly | emptySpecifies that element represents a control whose value is not meant to be edited
requiredrequired | emptySpecifies that the element is a required part of form submission
sizepositive integerNumber of options meant to be shown by the control represented by its element
srcURIURL for the audio stream
stepany | positive float | positive integerSpecifies the value granularity of the element's value
typebutton | checkbox | color | date | datetime | datetime-local | email | file | hidden | image | month | number | password | radio | range | reset | search | submit | tel | text | time | url | weekSpecifies that its input element is a one-line plain-text edit control for the input element's value
valuestringSpecifies a value for this input element
widthnon-negative integerHorizontal dimension

Types

NameDescription
buttona button with no additional semantics
checkboxa state or option that can be toggled
colora color-well control, for setting the element's value to a string representing a simple color
datea control for setting the element's value to a string representing a date
datetimea control for setting the element's value to a string representing a global date and time (with timezone information)
datetime-locala control for setting the element's value to a string representing a local date and time (with no timezone information)
emaila control for editing a list of e-mail addresses given in the element's value
filea list of file items, each consisting of a file name, a file type, and a file body (the contents of the file)
hiddena value that is not intended to be examined or manipulated by the user
imagean image from which the UA enables a user to interactively select a pair of coordinates and submit the form, or a button from which the user can submit the form
montha control for setting the element's value to a string representing a month
numbera precise control for setting the element's value to a string representing a number
passworda one-line plain-text edit control for entering a password
radioa selection of one item from a list of items (a radio button)
rangean imprecise control for setting the element's value to a string representing a number
reseta button for resetting a form
searcha one-line plain-text edit control for entering one or more search terms
submita button for submitting a form
tela one-line plain-text edit control for entering a telephone number
texta one-line plain text edit control for the input element's value
timea control for setting the element's value to a string representing a time (with no timezone information)
urla control for editing an absolute URL given in the element's value
weeka control for setting the element's value to a string representing a week

Examples

1 · accept

2 · alt

3 · autocomplete · off

4 · autocomplete · on

5 · autofocus

6 · checked

7 · disabled

8 · form

9 · formaction

10 · formenctype

11 · formmethod · delete

12 · formmethod · get

13 · formmethod · post

14 · formmethod · put

15 · formnovalidate

16 · formtarget

17 · height

18 · list

19 · max

20 · maxlength

21 · min

22 · multiple

23 · name

24 · pattern

25 · placeholder

26 · readonly

27 · required

28 · size

29 · src

30 · step

31 · type

32 · value

33 · width

34 · CSS