HTML.Input


An <input> element is a user-inteface element that enables interaction with the web page. There are different kinds of input elements, and these are specified using the element's type attribute.

Here is an example checkbox input:

<h1>Important Heading!</h1>
<p>Please check the checkbox below if this is a boring paragraph:</p>
<input name="isBoring" type="checkbox" checked="">

<input> elements are void elements:

  • start tag: required
  • end tag: always ommitted

attributes:

A list of attributes available on all HTML? elements.

  • id
  • class - space-seperated list of class names
  • lang
  • dir - element content direction
  • hidden
  • style
  • tabindex
  • title

list of attributes available specifically on <input> elements:

  • name
  • type
  • disabled
  • checked
  • form
  • value

limitations:

  • Cannot be used inside <A> tags (anchors), or <button> tags.
  • Any input element descendant of a <label> with a for attribute must have a matching ID value that matches the for attribute
  • The list attribute of an <input> element must refer to a <datalist>.
  • An <input> element with attribute type whose value is “button” must have a non-empty value attribute.
  • The usemap attribute on the <input> element has been obsoleted by use of the <img> element instead of <input> for constructing image maps.
  • The align attribute on the input element is obsolete. Use CSS instead.

See also