Posted By

fredaudet on 07/18/08


Tagged

javascript mootools transfer multi-select multiselect


Versions (?)

Multi-select transfer


 / Published in: JavaScript
 

  1. window.addEvent('domready', function() {
  2. $('add').addEvent('click', function() {
  3. $('select1').getSelected().each(function(el) {
  4. el.inject($('select2'));
  5. });
  6. });
  7. $('remove').addEvent('click', function() {
  8. $('select2').getSelected().each(function(el) {
  9. el.inject($('select1'));
  10. });
  11. });
  12. });
  13.  
  14.  
  15.  
  16. <div class="holder">
  17. <select multiple="multiple" id="select1" name="select1[]">
  18. <option value="1">Option 1</option>
  19. <option value="2">Option 2</option>
  20. <option value="3">Option 3</option>
  21. <option value="4">Option 4</option>
  22. </select>
  23. <a href="javascript:;" id="add">add >></a>
  24. </div>
  25. <div class="holder">
  26. <select multiple="multiple" id="select2" name="select2[]">
  27. <option value="5">Option 5</option>
  28. <option value="6">Option 6</option>
  29. </select>
  30. <a href="javascript:;" id="remove"><< remove</a>
  31. </div>

Report this snippet  

You need to login to post a comment.