multiple: HTML attribute

The Boolean multiple attribute, if set, means that the form control accepts one or more values. Valid for the email and file and <select> input types, how the user chooses multiple values depends on the form control.

Depending on its type, the form control may look different if the multiple attribute is set. For the file input type, the native messaging provided by the browser is different. In Firefox, the file input reads "No File Selected" when the attribute is present and "No File Selected" otherwise, when no file is selected. Most browsers display a scrolling <select> list box for a control with the multiple attribute set versus a single-line drop-down list when the attribute is omitted. Email-type input appears the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present.

When multiple is set to the email input type with the required attribute, the user can include zero (if not also ), one or more email addresses separated by commas.

<input type="email" multiple name="emails" id="emails">

If and only if the multiple attribute is specified, the value can be a properly formed comma-separated list of email addresses. Any trailing and leading white spaces are removed from each address in the list.

When multiple is set to the file input type, the user can select one or more files. The user can choose multiple files from the file chooser in any way permitted by the chosen platform.

<input type="file" multiple name="uploads" id="uploads">

When the attribute is omitted, the user can select only one file for <input>.

The multiple attribute on the <select> element represents a control to select zero or more options from the list of options. Otherwise, the <select> element represents a control for selecting a single <option> from the list of options.

<select multiple name="nani" id="nani">

When multiple is specified, most browsers will show a scrolling list box rather than a single-line drop-down menu.

Accessibility issues

Provide instructions to help users understand how to complete the form and use individual form controls. Indicate any mandatory and optional inputs, data formats and other relevant information. When using the multiple attribute, inform the user that multiple values are allowed and provide guidance on how to provide multiple values, such as "separate email addresses with a comma."

Setting size="1" to a multiple selection can make it appear as a single selection in some browsers, but then it doesn't expand to focus, hurting usability. Do not do it. If you change the appearance of a selection, and even if you don't, be sure to inform the user that more than one option can be selected by another method.