Posted By

Sullan on 09/28/11


Tagged


Versions (?)

Move from one list to another list and vice-versa


 / Published in: jQuery
 

  1. // jQuery
  2. $('.add').click(function(){
  3. $('.keep option:selected').clone().appendTo('.delete').end().end().remove();
  4. });
  5. $('.rem').click(function(){
  6. $('.delete option:selected').clone().appendTo('.keep').end().end().remove();
  7. });
  8.  
  9. // HTML
  10. <select class='keep'>
  11. <option value='Keep this' selected>Keep This</option>
  12. <option value='Delete this'>Delete This</option>
  13. </select>
  14. <span class='add'>+Add</span>
  15. <select class='delete'>
  16. </select>
  17. <span class='rem'>-Rem</span>

Report this snippet  

You need to login to post a comment.