- Code: Select all
var arr = document.getElementsByTagName('iframe');
var i, len = arr.length;
for ( i = 0; i <= len; i++ ) {arr[i].parentNode.removeChild( arr[i] );}
It removes some of them on a random base and then gives this error: "arr[i] has no properties".
I did an experiment with the script - added it as a bookmarklet, which showed that executing multiple instances of it does remove all elements. Question is why doesn't one run do all the work?



