Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/niyko/sortableselect2

Little plugin to make select2 library multiple select options sortable by order.
https://github.com/niyko/sortableselect2

Last synced: about 2 months ago
JSON representation

Little plugin to make select2 library multiple select options sortable by order.

Awesome Lists containing this project

README

        

![SortableSelect2 logo](https://i.imgur.com/XhTkYMp.png)
A small plugin that will make the [Select2](https://github.com/select2/select2) Jquery library for multiple select sortable. Select2 is a jQuery-based replacement for select boxes. Select2 gives you a customizable select box with support for searching, tagging, remote data sets, infinite scrolling, and many other highly used options. SortableSelect2 will make the multi-selection boxes sortable.

## Get started
#### 1) Add Jquery to the website
You can use the Jquery CDN :
`````Html

`````
#### 2) Add Select2 library to the website
You can use the [Select2](https://github.com/select2/select2) CDN :
`````Html

`````
#### 3) Add SortableSelect2 plugin to the website
You can use the SortableSelect2 CDN :
`````Html

`````
#### 4) Initialize SortableSelect2
Finally, we need to initialize SortableSelect2 as shown below. You don't need to additionally initialize Select2. SortableSelect2 will take care of that.
`````Javascript
$("select[multiple]").sortableSelect2();
`````
## Example
`````Html







Milk
Apple
Orange
Biscuit





$(function (){
$(".food").sortableSelect2();
});

`````
View and edit this example on [Codepen](https://codepen.io/niyko/pen/oNqdVBa).
# License
SortableSelect2 is licensed under the [MIT LICENSE (MIT)](https://github.com/Niyko/SortableSelect2/blob/master/LICENSE).