# Remove Children with Javascript

**URL:** <https://forum.kirupa.com/t/remove-children-with-javascript/138022>\
**Category:** Uncategorized\
**Created:** [February 19, 2005, 4:21am UTC](https://forum.kirupa.com/t/remove-children-with-javascript/138022 "2005-02-19T04:21:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Wheeler](https://avatars.discourse-cdn.com/v4/letter/j/59ef9b/32.png) [@Jeff\_Wheeler](https://forum.kirupa.com/u/Jeff_Wheeler)\
**Post date:** [February 19, 2005, 4:21am UTC](https://forum.kirupa.com/t/remove-children-with-javascript/138022/1 "2005-02-19T04:21:52Z")

</div>

Alright, don’t ask why, but I’ve got to do something very strange.

I need to remove all children of the body tag. I’m been trying for hours something like this:

```auto
for(i=0;i < document.childNodes[1].childNodes[1].length;i++) {
	document.childNodes[1].childNodes[1].removeChild*
}

```

But of course, that’s completely wrong. I admit, I’m trying to do a somewhat difficult project with little javascript knowledge, but I will continue to try.

Thanks,  
Jeff (how I love when my messages fit exactly inside the box…)
