648pages on
this wiki
Add New Page
Comments0 Share

The void HTML <input /> element defines the start of an input field where the user can enter data.


Attribute Value Description
accept list_of_mime_types A comma-separated list of MIME types that indicates the MIME type of the file transfer. Only used with type="file".
align right
alt text Defines an alternate text for the image. Only used with type="image".
autocomplete on
If on browsers can store the form's input values, to auto-fill the form if the user returns to the page. If off browsers should not store this information.
autofocus autofocus Makes the input field focused on page load. Cannot be used with type="hidden".
checked checked Indicates that the input element should be checked when it first loads. Used with type="checkbox" and type="radio".
disabled disabled Disables the input element when it first loads so that the user can not write text in it, or select it. Cannot be used with type="hidden".
form formname Defines one ore more forms the input field belongs to.
formaction URL Overrides the form's action attribute. Must be a valid URL that defines where to send the data when the form is submitted.
formenctype application/x-www-form-urlencoded
Overrides the form's enctype attribute. Defines the MIME type used to encode the content of the form.
formmethod get
Overrides the form's method attribute. Defines the HTTP method for sending data to the action URL.
formnovalidate true
Overrides the form's novalidate attribute. If true the input field should not be validated when submitted.
formtarget _blank
Overrides the form's target attribute. Specifies where to open the target URL.

  • _blank - The target URL will open in a new window
  • _self - The target URL will open in the same frame as it was clicked
  • _parent - The target URL will open in the parent frameset
  • _top - The target URL will open in the full body of the window
height pixels
Defines the height of an input field.
list id of a datalist Reference to a <datalist> element. If defined, a suggestion list should be displayed, with predefined options.
max number The input field's maximum value. Use together with the min attribute to create a range of legal values.
maxlength number Defines the maximum number of characters allowed in a text field.
min number The input field's minimum value. Use together with the max attribute to create a range of legal values.
multiple multiple If present the user is allowed more than one value.
name fieldname Defines a unique name for the input element. The name attribute is used to collect the fields value when submitted.
pattern JavaScript Pattern Defines a pattern or format for the input field's value. Example: pattern="[0-9]" means that the input value must be a number between 0 and 9. Use the standard title attribute to describe the pattern.
placeholder text Defines a hint to help users fill out the input field.
readonly readonly Indicates that the value of this field cannot be modified.
required required Defines if the input field's value is required in order to submit the form. Cannot be used with type: hidden, image, button, submit, reset.
size number of characters Defines how many characters should be visible in the input field.
src URL Defines the URL of the image to display. Use with type="image".
step number
Allowed when type=date, datetime, datetime-local, month, week, time, number, or range.
type button
Indicates the type of the input element. The default value is text. This is not a required attribute, but it should be included.
value value For buttons: Defines the text on the button. For image buttons: Defines the symbolic result of the field passed to a script. For checkboxes and radio buttons: Defines the result of the input element when clicked. The result is sent to the form's action URL. For hidden, password, and text fields: Defines the default value of the element. Cannot be used with type="file". This attribute is required with type="checkbox" and type="radio".
width pixels
Defines the width of an input field.
Global Attributes

See Global HTML Attributes.

HTML example:

<input type="button" value="Click" />

That will produce a clickable button with "Click" labeled on it.

See Also

External Links

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.