HTML Tutorial
HTML Forms
HTML Graphics
HTML Media
HTML API
HTML Input Attributes
The value Attribute
The input value attribute defines an initial or default value for an input field:
Example
Output:
The readonly Attribute
The input readonly attribute defines that an input field is read-only, which means that the input field cannot be modified.
Example
Output:
The disabled Attribute
The input disabled attribute defines that an input field must be disabled , which means that an input field is unusable and un-clickable.
Example
Output:
<
The size Attribute
The input size attribute defines the visible width, in characters, of an input field.
The default value for size is 20.
Example
Output:
The maxlength Attribute
The input maxlength attribute defines the maximum number of characters that are allowed in an input field.
Output:
The min and max Attributes
The input min and max attributes define the minimum and maximum values for the input field.
The min and max attributes are used with the following input types: number, range, date, DateTime-local, month, time, and week.
Example
Output:
The multiple Attribute
The input multiple attribute specifies enables the user to enter more than one value in an input field.
The multiple attribute is used with the following input types: email, and file.
Example
Output:
The pattern Attribute
The input pattern attribute defines the regular expression for which the input field’s value is checked, when the form is submitted.
The pattern attribute is used with the following input types: text, date, search, url, tel, email, and password.
Example
Output:
The placeholder Attribute
The input placeholder attribute gives a short hint which defines the expected value of an input field.
The placeholder attribute is used with the following input types: text, search, url, tel, email, and password.
Example
Output:
The required Attribute
The input required attribute defines an input field to be filled out before submitting the form
The required attribute is used with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file.
Example
Output:
The step Attribute
The input step attribute defines the legal number intervals for an input field.
Example: if step=”3″, legal numbers could be -3, 0, 3, 6, etc.
The step attribute is used with the following input types: number, range, date, datetime-local, month, time and week.
Example
Output:
The autofocus Attribute
The input autofocus attribute defines an input field that automatically get focus when the page loads.
Example
Output:
The height and width Attributes
The input height and width attributes specifies the height and width of an <input type=”image”> element.
Output: