title: jQuery Moving Items from one list to another based on the combobox selection
body: <p>I have two combobox one with all available Countries name and other is empty like:</p>
  
  <p><strong>Countries</strong></p>
  
  <pre><code>&lt;select name="countryId[]" multiple="multiple" id="countryId" size="10"&gt;
      &lt;option id="" value="1" &gt;Afghanistan&lt;/option&gt;
      &lt;option id="" value="3" &gt;Albania&lt;/option&gt;
      &lt;option id="" value="4" &gt;Algeria&lt;/option&gt;
      &lt;option id="" value="5" &gt;American samoa&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>Empty</strong></p>
  
  <pre><code>&lt;select name="mycountryId[]" multiple="multiple" id="mycountryId" size="10"&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Now if I select any country from Countries list it should move to Empty list but with <strong>selected</strong> attribute and exact <strong>value</strong> some thing if I select three countries from Countries list result should be:</p>
  
  <p><strong>Countries</strong></p>
  
  <pre><code>&lt;select name="countryId[]" multiple="multiple" id="countryId" size="10"&gt;
      &lt;option id="" value="1" &gt;Afghanistan&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>Empty</strong></p>
  
  <pre><code>&lt;select name="mycountryId[]" multiple="multiple" id="mycountryId" size="10"&gt;
      &lt;option selected="selected" id="" value="3" &gt;Albania&lt;/option&gt;
      &lt;option selected="selected" id="" value="4" &gt;Algeria&lt;/option&gt;
      &lt;option selected="selected" id="" value="5" &gt;American samoa&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>and similarly if I clicked on any country from my new country list (named <strong>Empty</strong>) then the selected country should move back to available countries list with <strong>un-selected</strong> attribute and exact <strong>value</strong>
  like
  <strong>Countries</strong>
  
          Afghanistan
          Algeria
  </p>
  
  <p>I follow <a href="https://stackoverflow.com/questions/5756703/jquery-moving-items-from-one-list-to-another-based-on-the-combobox-selection">Jquery - Moving Items from one list to another based on the combobox selection</a> it is very nice piece of code <strong>but how to make all values selected which are moving in targetCars?</strong> with <strong>selected</strong> attribute and vise versa?</p>