September 23, 2022

A Simple Dual Listbox Component in Pure Javascript

Dual Listbox is to make your multiple selections beautiful and easy to use using only javascript. No other frameworks/libraries are required. This JavaScript plug-in turns a normal selection box into a searchable double list box where users can move options between two selection panels.

dual list box stackblitz, dual list box material design, dual list box with search, dual list component, dual list box github, dual list box jquery

How to make use of it:

1. Add the “dual-listbox.css” stylesheet and the “dual-listbox.js” JavaScript file to the web page.

<link href="dist/dual-listbox.css" rel="stylesheet">
<script src="dist/dual-listbox.js"></script>

2. Configure DualListbox in the target selection box.

<select class="demo" multiple>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
  <option value="4">Four</option>
  <option value="5">Five</option>
  <option value="6">Six</option>
  <option value="7">Seven</option>
  <option value="8">Eight</option>
  <option value="9">Nine</option>
  <option value="10">Ten</option>
</select>
demo = new DualListbox('.selectDemo');

3. The default options for customizing the dual list box can be overwritten.

DualListbox('.selectDemo',{
  addEvent: function(value) {
      console.log(value);
  },
  removeEvent: function(value) {
      console.log(value);
  },
  availableTitle: 'Different title',
  selectedTitle: 'Different title',
  addButtonText: '>',
  removeButtonText: '<', addAllButtonText: '>>',
  removeAllButtonText: '<<',
  options: [
      {text:"Option 1", value: "OPTION1"},
      {text:"Option 2", value: "OPTION2"},
      {text:"Selected option", value: "OPTION3", selected:true}
  ]
});

Pure JS Dual List Box Component, Dual Listbox Plugin/Github


See Demo And Download

Official Website(maykinmedia): Click Here

This superior jQuery/javascript plugin is developed by maykinmedia. For extra Advanced usage, please go to the official website.

Share

You may also like...

Leave a Reply

Your email address will not be published.