multiple

The HTML multiple attribute allows users to select more than one file or option from a list, enabling multiple selections in file uploads or dropdown inputs.

multiple attribute

The multiple attribute in HTML enables users to select several files in a file input or multiple options from a dropdown menu. This improves the user experience by allowing multiple selections, making it more efficient to choose items like files or options in forms.

Syntax

index.html
<input type="file" multiple>

Example

  • Example of a dropdown menu that allows users to select multiple options:
The select multiple attribute

The multiple attribute specifies that multiple options can be selected at once:



Hold down the Ctrl (windows) or Command (Mac) button to select multiple options.

index.html
<h1>The select multiple attribute</h1>
<p>The multiple attribute specifies that multiple options can be selected at once:</p>
<form>
  <label for="cars">Choose a car:</label>
  <select name="cars" id="cars" multiple>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>
  </select>
  <br><br>
  <input type="submit" value="Submit">
</form>
<p>Hold down the Ctrl (windows) or Command (Mac) button to select multiple options.</p>

Definition and Usage

The multiple attribute is a boolean attribute.

When included, it enables the user to select or enter more than one value.

Values

  • The multiple attribute is a boolean attribute, meaning it doesn't take any values when applied.

Applies To

The multiple attribute can be used on the following html elements.

Conclusion

The multiple attribute allows users to select more than one option or file at once, enhancing the flexibility of form inputs. It applies to elements like <input> and <select>. This attribute is especially useful for enabling bulk selection in file uploads or dropdown lists.