/* * MultipleSelectPicker, a different interface for using multiple-selects * * Copyright (c) 2009 Paul Klinkenberg * blog: http://www.coldfusiondeveloper.nl/ * Licensed under the GPL license v 3.0, see http://www.gnu.org/copyleft/gpl.html * * Date: 2009-05-08 17:56:00 +0100 * Usage: *
* * * * * ... */ function MultipleSelectPicker() { var translations = { 'nl': { 'add': 'voeg toe' , 'remove': 'verwijder' }, 'default': { 'add': 'add' , 'remove': 'remove' } }; // this is the lang to use when no lang is given via the init(lng) function var lang = 'default'; this.init = function(lng) { // set the language if (lng && lng in translations) lang = lng; $('select[multiple]').each(function(){ var sel = $(this); var width = sel.width() - 5; sel.css({'width': width/2 + 'px', 'float': 'left'}); // give the select an id if it didn't have one if (sel.attr('id')=='') sel.attr('id', sel.attr('name')+'__MultipleSelectPicker'); var newSel = sel.clone(); // set new attributes for the sel select (= the left one) sel.attr('id', sel.attr('id')+'_choose'); sel.attr('name', '_xx_'); sel.css('margin-right', '5px'); // have the selects point at eachother sel.attr('rel', newSel.attr('id')); newSel.attr('rel', sel.attr('id')); newSel.insertAfter(sel); $("