Multi-select Dropdown Component With Vanilla JavaScript – sellect.js

Category: Form , Javascript | November 19, 2023
Views Total:1,626 views
Official Page:Go to website
Last Update:November 19, 2023


Multi-select Dropdown Component With Vanilla JavaScript – sellect.js


sellect.js is a vanilla JavaScript plugin that converts a standard input into a multi-select dropdown UI where the users can select multiple items from an autocomplete/autosuggest list. Great for tag/token manager.

How to use it:

Include the needed Font Awesome for the icons.

<link rel="stylesheet" href="font-awesome.css">

Download and load the sellect.js’ JavaScript and Stylesheet in the document.

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

Create a normal input field:

<input type="text" id="my-element">

Create a new ‘sellect object and define the original and destination item lists in the JavaScript.

var mySellect = sellect("#my-element", {
    originList: ['banana', 'apple', 'pineapple', 'papaya', 'grape', 'orange', 'grapefruit', 'guava', 'watermelon', 'melon'],
    destinationList: ['banana', 'papaya', 'grape', 'orange', 'guava']

Initialize the plugin and done.


Callback functions available.

var mySellect = sellect("#my-element", {
    // Called when the destination list receives a new item
    onInsert: function( event, item ) {},
    // Called when an item is removed from destination list
    onRemove: function( event, item ) {}

API methods.

// Return a list of selected items
// Return a list of unselected items


v1.0.2 (11/19/2023)

  • fix(case-sensitive): makes the filter to work as case-insensitive

You Might Be Interested In:

2 thoughts on “Multi-select Dropdown Component With Vanilla JavaScript – sellect.js

  1. Maarten

    Love this! Do you know an easy way to use dynamic data loaded through liquid in the options and preloaded options?


Leave a Reply