[Javascript] How to destroy an element?

Paul Novitski paul at juniperwebcraft.com
Fri Aug 18 14:53:51 CDT 2006


At 12:33 PM 8/18/2006, Peter Lauri wrote:
>Thanks, I assume that the input in my case should just be the element I want
>to delete.!?


The core code you need to execute is:

         // point to the desired element
         var oEl = document.getElementById('myId');

                 // if it exists, remove it
                 if (oEl) oEl.parentNode.removeChild(oEl);

Peter, I strongly recommend that you read and bookmark this document:

         Gecko DOM Reference
         http://developer.mozilla.org/en/docs/Gecko_DOM_Reference

It explains all of the properties, methods, and event handlers in the DOM.

Warm regards,
Paul 




More information about the Javascript mailing list