Posted By

j100 on 01/31/13


Tagged

select list remove selected items ListBox selectbox


Versions (?)

Remove selected items from select box


 / Published in: JavaScript
 

This will remove the items in a select box/list box that have been selected.

  1. function remove_selected_items(listid){
  2. var list = document.getElementById(listid);
  3. var items = list.options.length;
  4.  
  5. for(var i = items-1; i >= 0; i--) {
  6. if(list.options[i].selected == true){
  7. list.remove(i);
  8. }
  9. }
  10. }

Report this snippet  

You need to login to post a comment.