Adrian Cross
asked on
Delete only the children divs from a parent div
Hi, I'm trying to delete all the children divs that I created dynamically in a parent div. The parent div contains different controls, not just divs.
If there is only one child div, the code works fine. However, when I append multiple divs I get the following error
"JavaScript runtime error: No such interface supported"
Any ideas?
Thanks
var imgContainer = document.getElementById("ContentPlaceHolder1_div_Container");
var childDivs = imgContainer.getElementsByTagName("div");
var NumberOfDivs = childDivs.length;
for (i = 0; i < NumberOfDivs; i++) {
imgContainer.removeChild(childDivs[i]);
}
If there is only one child div, the code works fine. However, when I append multiple divs I get the following error
"JavaScript runtime error: No such interface supported"
Any ideas?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER