title: JQuery: Append to listbox - setting JSON data as value
body: <p>I'm trying to append all the selected items from listbox 1 to listbox 2, and it's working fine. The problem is that I want to set the item values of the listitems on listbox 2 to an ID i get from JSON.</p>
  
  <p>I have the ID from JSON, but I'm not sure how to set the values when I use appendTo.</p>
  
  <p>Here's the code I'm using now, when the values is set to "0":</p>
  
  <pre><code>    $('#ListBox1 option:selected').appendTo('#ListBox2');
  </code></pre>
  
  <p>I think I have to do something like this:</p>
  
  <pre><code>   var numberOfSelectedItems = $('#ListBox1 option:selected').length;     
     for(int i = 0; i &lt; numberOfSelectedItems; i++)
     {
        var ID = data.array[i].ID; //This is the ID value from JSON.
  
        //TODO: Set the ID as value on each selected item
     }
  </code></pre>
  
  <p>Please help =)</p>