This piece of javascript code is created to remove all inputs that are within a div
function remove_inputs(){
var elements=document.getElementById('thediv').getElementsByTagName('input');
for(var i=0;i<elements.length;i++){
elements[i].parentNode.removeChild(elements[i]);
}
}
I does remove only half of elements a call and I have to call it several times in order to remove all inputs.
Please check this Jsfiddle to see it in action.