|
|
function to remove all child nodes - DOM
|
Views : 503
|
|
Tagged in : DOM
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
You can use the following javascript function to remove all children of a given parent node
function removeChildNodes(obj)
{
if(obj.hasChildNodes() && obj.childNodes) {
while(obj.firstChild) {
obj.removeChild(obj.firstChild);
}
}
}
so if you want to remove everything from the page, you can just call the javascript function as
<script language=javascript>
removeChildNodes(document.body);
</script> |
|
By rajesh, On - 2009-09-19 |
|
|
|