Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete/Remove element

Status
Not open for further replies.

PoppapumpJ

Programmer
Dec 17, 2001
86
US
I am looking to completely remove an element from the page and memory.

The example I have shown ACTS like what I want. When you click the button, the table goes away. However it is just being hiddin. Does anyone know how to remove it completely from the DOM?

Thanks

[tt]
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<SCRIPT>

function DeleteThing(){

document.all.testTable.style.display = 'none';

}

</SCRIPT>

</HEAD>
<BODY>

<table id=&quot;testTable&quot; border=5 cellpadding=0 cellspacing=0 >
<TR><TD>test</TD></TR>
</Table>
<INPUT type=&quot;button&quot; onclick=&quot;javascript: DeleteThing();&quot; value=&quot;Button&quot; id=button2 name=button2>
</BODY>
</HTML>
[/tt]
 
May be the following example help you:

<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<SCRIPT>

function DeleteThing(){

document.all.iTable.innerHTML=&quot;&quot;;
}

function existingTest() {
alert(&quot;Table: &quot;+document.all.testTable);
}

</SCRIPT>

</HEAD>
<BODY>
<div id=&quot;iTable&quot;>
<table id=&quot;testTable&quot; border=5 cellpadding=0 cellspacing=0 >
<TR><TD>test</TD></TR>
</Table>
</div>
<INPUT type=&quot;button&quot; onclick=&quot;javascript: DeleteThing();&quot; value=&quot;Button&quot; id=button2 name=button2>
<INPUT type=&quot;button&quot; onclick=&quot;javascript: existingTest();&quot; value=&quot;Test&quot; id=button2 name=button2>
</BODY>
</HTML>

Regards,
Sergey Smirnov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top