The multiple attribute allows users to enter or select more than one value in an input field. It is commonly used with file and email input types.
- Allows selection of multiple files or multiple email addresses.
- Commonly used with <input type="file"> and <input type="email">.
- Improves flexibility by accepting multiple inputs at once.
Syntax:
<input multiple>
Example: Multiple attribute to create a form with multiple file input in single input element.
- In this example we have Header elements (<h1> and <h2>) styled in green and italicized.
- Includes a form with a file input (<input type="file">) with the multiple attribute allowing selection of multiple files.
- Provides a submit button (<input type="submit">) within the form for user interaction.
HTML <input> multiple Attribute Use cases
- Multiple Value Input: The multiple attribute allows users to enter or select more than one value in an input field.
- Multiple File Selection: When used with <input type="file">, it enables users to select and upload multiple files at the same time.
- HTML5 Support: The multiple attribute is supported in HTML5 and is commonly used for file and email inputs.