Hello,
I'm currently studying javascript by myself.
I thought that I will write js that will remove element in the body from DOM every 2 seconds, untill all elements in the body are deleted( except debug <span> :) )
At first I tried to go through the elements with loop, but when I call setTimeout() the loop doesn't wait setTimeout() to end, but it continues looping.
Now I use recursion. setTimeout() call the function which do the stuff.
But when there is more nested tag( as in the sample html below <ul><li></li</ul> ) inner recursive function( cDestoyer() at the middle of the function body ) stops for some reason.
And whole ul is deleted, not element by element.
When I don't use setTimeout(), recursion is working correctly.
Any help will be appreciated.
Here is the example: http://www.svubit.eu/iskren/