Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/niyko/sortableselect2
- Owner: Niyko
- License: mit
- Created: 2022-08-06T14:25:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-07T02:46:22.000Z (over 2 years ago)
- Last Synced: 2024-10-20T03:11:59.588Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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).