Example

A simple <input> tag:

Laboratory

description & Usage

The <input> tag is used in forms to accept input from the user.

The <input> tag has an important attribute called type which determines how the input will be accepted. By changing this attribute, you can accept input from the user in different forms.

To see the various types of <input> elements, please refer to the input type attribute page.

Notes

The <label> tag is typically used to label <input> elements.

Browser compatibility and Support

# Chrome Edge Firefox Safari Opera
<input>

Attributes

Attributes Values Description
accept
file
Determines the types of files that the server accepts; only for ( type="file" ).
alt
text img
Places alt text in place of an element that is not displayed.
autocomplete
on-off
Determines whether the corresponding tags on the right are automatically enabled or not.
checked
checked
Determines that the corresponding tag on the right is selected before the page is opened.
dirname
inputname.dir
Specifies the direction of the text to be sent.
disabled
all
It is used to disable the corresponding elements on the right side.
form
all
The name <form> is used for the tags inserted on the right side.
formaction
URL
It determines the place to send information inside <form> (this feature is only used for "sending").
height
pixels
Determines the height of the corresponding tags on the right.
list
datalist_id
It depends on the <datalist> tag along with the predefined options in the corresponding tag on the right.
max
number - date
Specifies a maximum of one value.
name
text
Specifies the name of the tag.
placeholder
text
It is used to specify the desired value of a tag and to give a short reference to it.
type
all
Determines the type of the corresponding tags on the page.
value
text
Specifies the value of the corresponding tags in the side.
width
pixels
Determines the width of the corresponding elements on the right.

Global Attributes

The <input> tag supports the HTML Global Attributes.

Event Attributes

The <input> tag supports the HTML Event Attributes.