The multiple attribute allows users to select more than one option from a dropdown list. It is commonly used when multiple selections are required in a form.
- Enables selection of multiple options in a <select> element.
- Users can select multiple items using keyboard keys like Ctrl or Shift.
- It is a boolean attribute, so its presence alone enables multiple selection.
Syntax:
<select multiple> <!--Driver Code Starts-->
<html>
<!--Driver Code Ends-->
<body>
<center>
<h1 style="color:green; font-style:italic;">
Geeksforgeeks
</h1>
<h2 style="font-style:italic; color:green;">
HTML select multiple Attribute
</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>
</center>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->