Click to See Complete Forum and Search --> : Remove a div by it's ID ( and all elements within )
listenmirndt
09-06-2008, 05:35 AM
<div id=~3~>Industrial Goods<input type="button" value="Delete" onClick="DeleteThis('~3~|Industrial Goods')"><br></div>
So basically... it will delete itself..
Thanks!
Weedpacket
09-06-2008, 09:41 PM
You remove it from its parentNode (http://developer.mozilla.org/en/DOM/Element.parentNode).
Incidentally, attribute values should be quoted, and "~3~" is not a valid value for an id attribute.
leatherback
09-20-2008, 05:07 AM
so what weed refers to:
// Delete the specified element, specified by the TheElement ID
function DelDiv(TheElement)
{
ToDelete = document.getElementById(TheElement);
ToDelete.parentNode.removeChild(ToDelete);
}
PHP Builder
Copyright Internet.com Inc. All Rights Reserved.