[thelist] DOM - removeNode() problems

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 4 21:51:47 CDT 2003


--- Jeff Howden <jeff at jeffhowden.com> wrote:
> no it's not.  the removeNode() method acts upon the object you're
> calling it on.  in other words, if you're calling the removeNode() 
> method on the <div> you originally appended the node to, then that 
> node will be removed.  once removed, it's no longer available for 
> later.

Ahh, well then I misread my source. Still odd that after I removed
it, I could alert it as an object.

> first, and simplest, you can set the innerHTML of your error <div>
> to an empty string.

Yeah, while easy I want to avoid it since its not the DOM.

> second, you can return an array of all the child nodes in the error
> <div>,
> loop over that array, and remove each child node independently
> using the
> removeNode() method, calling it on each child node.
> 
> or third, you can return an array of all the child nodes in the
> error <div>,
> loop over that array, and remove each child node independently
> using the
> removeChild() method, calling it on the parent node.

I like 2 and 3 the best, I'll try those. Thanks jeff.

Tom

=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward


More information about the thelist mailing list