The Boolean required attribute, if present, indicates that the user must specify a value for the input before the owning form can be submitted.
The required attribute is supported by text, search, url, tel, email, password, date, month, week, time, datetime-local, number, checkbox, radio, file, <input> types along with the <select> and <textarea> form control elements. If present on any of these input types and elements, the :required pseudo class will match. If the attribute is not included, the :optional pseudo class will match.
The attribute is not supported on, or relevant to, range and color input types, as both have default values. Type color defaults to #000000. Type range defaults to the midpoint between min and max — with min and max defaulting to 0 and 100 respectively in most browsers if not declared. required is also not supported on the hidden input type — users cannot be expected to fill out a hidden form field. Finally, required is not supported on any button input types, including image.
In the case of a same named group of radio buttons, if a single radio button in the group has the required attribute, a radio button in that group must be checked, although it doesn't have to be the one on which the attribute is applied. To improve code maintenance, it is recommended to either include the required attribute in every same-named radio button in the group, or else in none.
In the case of a same named group of checkbox input types, only the checkboxes with the required attribute are required.
Note: Setting aria-required="true" tells a screen reader that an element (any element) is required, but has no bearing on the optionality of the element.