Return to Snippet

Revision: 62061
at January 31, 2013 11:06 by j100


Updated Code
function remove_selected_items(listid){
	var list = document.getElementById(listid);
	var items = list.options.length;

	for(var i = items-1; i >= 0; i--) {
		if(list.options[i].selected == true){
			list.remove(i);
		}
	}
}

Revision: 62060
at January 31, 2013 11:03 by j100


Initial Code
function remove_selected_items(listid){
	var list = document.getElementById(listid);
	var items = list.options.length;

	for(var i = num_items-1; i >= 0; i--) {
		if(list.options[i].selected == true) {
			list.remove(i);
		}
	}
}

Initial URL

                                

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

Initial Title
Remove selected items from select box

Initial Tags
list

Initial Language
JavaScript