LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 March 28 2014

rolf
Member

Deleting a DOM element in Javascript

I just thought this was kind of funny...
This is the only way I know of to have DOM element (here "image") delete itself, using JavaScript:

image.parentNode.removeChild(image);

Since there is not delete() method or anything like that on the element itself, as per DOM specs, you have to invoke the removeChild() method of the parent...

Offline

Board footer