In this section, we will learn what the multiple attribute is in HTML <select> element and how to use it.
What is multiple Attribute in HTML <select> Tag?
By default, a dropdown list created via an HTML <select> element allows users to select only one item. But sometimes we have a dropdown list and want users to be able to select more than one value from that list!
This is where we can use the `multiple` attribute.
Basically, by applying this attribute to a select element, users are then able to select more than one item from that list.
Note: to select more than one value, users need to hit and hold the “control” key on their keyboard while selecting items from the dropdown list.
HTML multiple Attribute in <select> Tag Syntax:
<select name = “name” multiple> </select>
<select> Tag multiple Attribute Values
The multiple attribute doesn’t need a value. Simply put, this attribute in the opening tag of an HTML <select> element.
Example: using multiple attribute in HTML <select> tag
See the Pen using multiple attribute in HTML <select> tag by Omid Dehghan (@odehghan) on CodePen.