Skip to content

A simple javascript library for multiple select component that supports Bootstrap 4 natively.

License

Notifications You must be signed in to change notification settings

ibnujakaria/multiple-select-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiple Select

A simple javascript (non jQuery) library for multiple select component that supports Bootstrap 4 natively.

Installation

You can install multiple-select-js in 3 options:

Using NPM

npm i multiple-select-js

And then, simply import it using es6 syntax.

import MultipleSelect from 'multiple-select-js'

Using CDN

<!-- Bootstrap 4 -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- Multiple Select JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/css/multiple-select.css">
<script src="https://cdn.jsdelivr.net/npm/multiple-select-js/dist/js/multiple-select.js"></script>

Manually Download

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

Basic Usage

For single select.

<div class="form-group">
  <label for="select-language">Single Select</label>
  <select id="select-language">
    <option value="php">PHP</option>
    <option value="javascript">Javascript</option>
    <option value="python">Python</option>
    <option value="java">Java</option>
  </select>
</div>
new MultipleSelect('#select-language', {
  placeholder: 'Select Language'
})

For Multiple select you can simply add multiple attribute to the select tag.

<div class="form-group">
  <label for="select-language">Multiple Select</label>
  <select id="select-multiple-language" multiple>
    <option value="php">PHP</option>
    <option value="javascript">Javascript</option>
    <option value="python">Python</option>
    <option value="java">Java</option>
  </select>
</div>
new MultipleSelect('#select-multiple-language', {
  placeholder: 'Select Language'
})

Documentation

Go to this link for the complete documentation.

License

The Multiple Select Js library is open-source software licensed under the MIT license.