Valid for the image button only, the alt attribute provides alternative text for the image, displaying the value of the attribute if the image src is missing or otherwise fails to load. Valid for the file input type only, the accept attribute defines which file types are selectable in a file upload control. A value is required or must be check for the form to beĪ few additional non-standard attributes are listed following the descriptions of the standard attributes. Text that appears in the form control when it has no value setīoolean. Minimum length (number of characters) of valueīoolean. Maximum length (number of characters) of value
Name of form field to use for sending the element's directionality inĪssociates the control with a form elementįorm data set encoding type to use for form submissionīypass form control validation for form submission Whether the command or control is checked Media capture input method in file upload controls Required for accessibilityĪutomatically focus the form control when the page is loaded Hint for expected file type in file upload controlsĪlt attribute for the image type. Those with extra importance as it relates to are highlighted. This element includes the global attributes. Attributes that are unique to particular input types-or attributes which are common to all input types but have special behaviors when used on a given input type-are instead documented on those types' pages.
Those that are common to most or all input types are defined in greater detail below. This table is followed by a list describing each attribute in greater detail, along with which input types they are associated with. This section provides a table listing all the attributes with a brief description. In addition, the way some attributes impact an input depends on the input type, impacting different input types in different ways. However, in reality, most attributes have an effect on only a specific subset of input types. Since every element, regardless of type, is based on the HTMLInputElement interface, they technically share the exact same set of attributes. The element is so powerful because of its attributes the type attribute, described with examples above, being the most important.