The <input> element

The <input> element is used to create interactive controls for web-based forms to accept data from the user. Various types of input data and control widgets are available, depending on what use you need. The <input> element is one of HTML's most powerful and complex. The DOM HTMLInputElement interface provides the properties and methods for working with the options, layout, and presentation of <input> elements.

Technical summary

Content categories Flow content, listed, submittable, resettable, form-associated element, phrasing content. If the type is not hidden, then labelable element, palpable content.
Permitted content None; it is a void element.
Tag omission Must have a start tag and must not have an end tag.
Permitted parents Any element that accepts phrasing content.
Implicit ARIA role
  • type=button: button
  • type=checkbox: checkbox
  • type=email
    • with no list attribute: textbox
    • with list attribute: combobox
  • type=image: button
  • type=number: spinbutton
  • type=radio: radio
  • type=range: slider
  • type=reset: button
  • type=search
    • with no list attribute: searchbox
    • with list attribute:combobox
  • type=submit: button
  • type=tel
    • with no list attribute: textbox
    • with list attribute: combobox
  • type=text
    • with no list attribute: textbox
    • with list attribute: combobox
  • type=url
    • with no list attribute: textbox
    • with list attribute: combobox
  • type=color|date|datetime-local|file|hidden|month|password|time|week: no corresponding role
Permitted ARIA roles
  • type=button: checkbox, combobox, link, menuitem, menuitemcheckbox, menuitemradio, option, radio, switch, tab
  • type=checkbox: button when used with aria-pressed, menuitemcheckbox, option, switch
  • type=image: link, menuitem, menuitemcheckbox, menuitemradio, radio, switch
  • type=radio: menuitemradio
  • type=text with no list attribute: combobox, searchbox, spinbutton
  • type=color|date|datetime-local|email|file|hidden| month|number|password|range|reset|search|submit|tel|url|week or text with list attribute: no role permitted
DOM interface HTMLInputElement