windy
02-10-2007, 08:00 AM
Hi,
I'm using the following code to remove all child nodes from a parent. I guess it's another example that breaks IE(7). Can someone suggest an IE-tolerant alternative.
Thanks, windy
var strID = 'parentNodeName';
var parent = document.getElementById(strID);
removeChildNodes(parent);
function removeChildNodes(parent){
while(parent.hasChildNodes()){
parent.removeChild(parent.childNodes[0]) //--> IE error 'Not found'
}
}
I'm using the following code to remove all child nodes from a parent. I guess it's another example that breaks IE(7). Can someone suggest an IE-tolerant alternative.
Thanks, windy
var strID = 'parentNodeName';
var parent = document.getElementById(strID);
removeChildNodes(parent);
function removeChildNodes(parent){
while(parent.hasChildNodes()){
parent.removeChild(parent.childNodes[0]) //--> IE error 'Not found'
}
}