Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a dropdown multi select? [duplicate]

I'm trying to make a dropdown to be multi-select.

For example, I should be able to select Option 1, Option 2, Option 3, and Option 4 at the same time.

Just to make things more understandable. I'm attaching the desired result below:

enter image description here

<select>
  <option>All</option>
  <option>Option 1</option>
  <option>Option 2</option>
  <option>Option 3</option>
  <option>Option 4</option>
</select>
like image 744
BillNathan Avatar asked Dec 07 '22 12:12

BillNathan


1 Answers

You can use multiple as a property of select tag. It is a basic feature of HTML.

Here is an example :

<select multiple>
  <option value="val1">Val1</option>
  <option value="val2">Val2</option>
  <option value="val3">Val3</option>
  <option value="val4">Val4</option>
</select>

Or you can use any jQuery plugins for the same.

like image 109
Nick Avatar answered Dec 11 '22 09:12

Nick