Tutorialspoint.dev

HTML | multiple Attribute

This attribute is a Boolean Attribute. It specifies that the user is allowed to select more than one value that presents in an element.

Syntax:

<input multiple>

Elements: This method can have following attributes:

  • <input>
  • <select>

Attribute: The attribute for each of the above element is multiple.

Example: With <input> element



<!DOCTYPE html>
<html>
<body>
<center>
<h1 style="color:green;font-style:italic;">GeeksForGeeks</h1>
<h2 style="color:green;font-style:italic;">multiple Attribute in Input Element</h2>
<form action=" ">
  Select images: <input type="file" name="img" multiple>
  <input type="submit">
</form>
  
</body>
</html>

Output:

Example: With <select> element

<html>
<body>
<center>
<h1 style="color:green;font-style:italic;">Geeksforgeeks</hg1>
<h2 style="font-style:italic;color:green;">multiple Attribute in Select Element</h2>
<form action=" ">
<select name="Bikes" multiple>
  <option value="HeroHonda">HeroHonda</option>
  <option value="Splender">Splender</option>
  <option value="Ninja">Ninja</option>
  <option value="Pulsav">Pulsav</option>
</select>
<input type="submit">
</form>
  
<p>Hold down the Ctrl (windows) / Command (Mac) button to select multiple options.</p>
  
</body>
</html>

Output:

Supported Browsers: The browser supported by multiple Attribute are listed below:

  • Apple Safari 1+
  • Google Chrome 1+
  • Firefox 1+
  • Opera 4+
  • Internet Explorer 2+


This article is attributed to GeeksforGeeks.org

leave a comment

code

0 Comments

load comments

Subscribe to Our Newsletter