|
|
Introduction
jqMultiSelects is a plugin for jQuery which enables the addition of common behaviour to <select> elements allowing multiple options to be selected.
Features
jqMultiSelects enables you to deal purely with the presentation of your <select> elements, and then use the plugin to attach common behaviours to them. Current features include:
- Set up double-click transferring of options from one select to another
- Enable transferring of multiple options via an external element, e.g. <button>, <input>, <a>, etc.
- Automatic submission of <option> elements with parent form submission
- Callbacks to hook into the process
- Size is 4.4KB or 0.6KB packed
Example
To implement, start by creating your <select> elements:
<select name="left" id="select_left" multiple="multiple"> <option>Item 1</option> <option>Item 2</option> </select></td> <a id="options_right" href="#">move right</a> <a id="options_left" href="#">move left</a> <select name="right" id="select_right" multiple="multiple"> <option>Item 3</option> <option>Item 4</option> </select>
Then, to add the Multi-Selects behaviour to these listboxes, simply perform the following (usually in the $(document).ready() event):
$(document).ready(function() {
$("#select_left").multiSelect("#select_right", {trigger: "#options_right"});
$("#select_right").multiSelect("#select_left", {trigger: "#options_left"});
})Changelog
Version 0.2 <option> elements can be automatically selected upon parent form submission plugin options now passed as an array all element identifiers now taken as jQuery selectors instead added beforeMove and afterMove callback functions Version 0.1 initial release
Future Development
Currently planned additions (roughly in priority order) include:
- enable a graceful degradation - e.g. convert a group of checkboxes into 2 multiple selects
- Add ability to manually order items within a list
- Investigate <select> sorting plugins and check integration with transfers is easy
Discussion
I am not often on the jQuery mailing list these days, but I get notified of any activity on this project so if you have any requests, suggestions, bug reports, modifications then please post them in the 'issues' section here.
