From one select list / list to another jquery way

How to add select / listbox from one list to another, I try this way, but butit does not work.

$('#Select1').dblclick(function(){
$('<option name="$("#Select1").
            val()">$("#Select1").
            val()</option>').
                             appendTo('#Select2');
}); 

I want on dblclick on one if the items in the listbox = Select1 are added to Select2

+3
source share
2 answers

I worked and an example that does what you are looking for.

Add to selection box with double click

+2
source
$('#select1 option:selected').appendTo('#select2');

I made a live page while checking jsfiddle if ur needed

Example

+2
source

All Articles