Do you know of any good way/plugin to do this with jquery or any description on how to approach this eff开发者_JS百科ectively.
This seems like what you're looking for:
"Easy Multi-Select Transfer with jQuery"
http://blog.jeremymartin.name/2008/02/easy-multi-select-transfer-with-jquery.html
Quick snippet, assumes you have two select lists ID'd #select 1 and #select2, as well as two buttons with IDs #add and #remove.
$().ready(function() {
$('#add').click(function() {
return !$('#select1 option:selected').remove().appendTo('#select2');
});
$('#remove').click(function() {
return !$('#select2 option:selected').remove().appendTo('#select1');
});
});
This is how i ended up doing it
Multiple.Move = function (from, to)
{
$('#' + from + ' option:selected').remove().appendTo('#' + to);
}
And some html for the buttons and the select.
<select multiple="multiple" id="available">
<option value="1">BMW</option>
<option value="1">Volvo</option>
<option value="1">Audi</option>
<option value="1">Saab</option>
</select>
<input type="button" value="Add" onclick="Multiple.Move('available', 'selected')" />
<input type="button" value="Remove" onclick="Multiple.Move('selected', 'available')" />
<select multiple="multiple" id="available">
</select>
精彩评论