![]() |
How do I delete an object in DHTML ???
I've created a Div using a JavaScript and DHTML ... and it worked just fine...
But in order to use the JavaScript again I need to somehow delete the object "Div" that was generated before. Does anybody knows how to do that ??? How do I delete, release or something to the object in order to re-create it with other atributes ??? Any Ideas??? Thanks a lot. |
W3C DOM way (works in IE5+/NS6+):
var div = refToDiv //document.getElementById('divID') perhaps div.parentNode.removeChild(div); IE-way (IE4+): refToDiv.outerHTML = ''; |
Thanks jkd
It worked...
Thanks a lot jkd... :thumbsup: |
Hey jkd,
what does this do? document.getElementById("elemName").style.display="none"; |
it makes the element not displayed (hidden) not occupying a space in the screen.
Quote:
|
Quote:
Difference between setting element's visibility to hidden and setting element's display to none, is that element do not reserve the space it needs when display property has been set to none. Read : http://www.w3schools.com/css/pr_class_display.asp |
The element still exists though, it just isn't rendered. Often that is enough, but sometimes you need to truely delete the node using the methods I described above.
|
Quote:
|
| All times are GMT +1. The time now is 03:54 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.