Open In App

HTML <input> multiple Attribute

Last Updated : 08 Mar, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

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:

HTML input multiple attribute example output

HTML multiple Attribute

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

1. How to specify that a user can enter more than one value in an input element in HTML5?

In HTML5, add the multiple attribute to the <input> element, specifically for type file, allowing users to select and submit multiple files simultaneously.

2. How to Select Multiple Files using HTML Input Tag ?

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:


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads