I am making a function to remove some elements, the user clicks on a check-box and the a function removes all elements that are checked, I am able to retrieve all the ids of the elements to be removed and store them in an array so I can then do something like this:

Code JavaScript:
document.getElementById(form_values[0]).removeChild(document.getElementById(ids[i]));

But that is not working for me.

I have checked and ids[] does contain all the elements ids to be removed

I get an exemption in firebug

Code:
uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLFormElement.removeChild]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost/clms/libraries/connect/calli_modules/calli_forms/form_create.php# :: group_selected_items :: line 411" data: no]
Code JavaScript:
function group_selected_items(){
	var grouped_items = document.getElementById(form_values[0]).getElementsByTagName('a');
	var ids = [];
	for (var i = 0; i < grouped_items.length; i++){
		if (grouped_items[i].className === 'checkbox checkbox_c') {
			ids[i] = grouped_items[i].parentNode.parentNode.id;
		}
	}
	for (var i = 0; i < ids.length; i++){
		//alert(ids[i]);
		document.getElementById(form_values[0]).removeChild(document.getElementById(ids[i]));
	}
}