HTML <input> multiple Attribute
The HTML <input> multiple Attribute is a Boolean Attribute. It specifies that the user is allowed to select more than one value that is present in an element. The multiple attributes work with many input fields such as email, file, etc.
Syntax:
<input multiple>
HTML <input> multiple Attribute Example
Example: This example uses multiple attribute to create a form with multiple file input in single input element.
HTML
<!DOCTYPE html> < html > < body > < h2 >HTML input multiple Attribute</ h2 > < form action = " " > Select images: <!-- Using multiple attribute for multiple file input--> < input type = "file" name = "img" multiple /> < input type = "submit" /> </ form > </ body > </ html > |
Output:
Explanation:
- 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
In HTML5, add the multiple attribute to the <input> element, specifically for type file, allowing users to select and submit multiple files simultaneously.
To select multiple files using HTML <input> tag, set its type attribute to “file” and include the multiple attribute, allowing users to select multiple files at once.
Supported Browsers
The browser supported by value attribute in option tag are listed below:
Contact Us