Multiple Select Dropdown List In JS

A vanilla  JavaScript multi-select plugin that turns a multi-select element into a user-friendly tags input.
Users can choose from a variety of items in the dropdown menu. To remove a selected option, click the ‘X’ button.

Incorporate the document’s core JavaScript and Stylesheet.

<link rel="stylesheet" href="css/style.css">
<script src="js/index.js"></script>

Connect the plugin to a multi-select element and you’re good to go.

<select multiple="multiple" id="multiDrop">
  <option>Angular</option>
  <option>React</option>
  <option>.netCore</option>
  <option>Mvc</option>
</select>
var myDropdown = new drop({
    selector:  '#multiDrop'
});

Specify an array of preselected options.

var myDrop = new drop({
    selector:  '#multiDrop'
    preselected: [0, 2]
});

 

Submit a Comment

Your email address will not be published.

Subscribe

Select Categories