I'm using plain old JavaScript (no jQuery or other).
I have an HTML5 app where I want to delete canvas from a section element:
<section id="thumbnails">
<h1>My Bookmarks:</h1>
<canvas height="60px" width="100px" data-time="2.1167500019073486"></canvas>
<canvas height="60px" width="100px" data-time="3.60492205619812"></canvas>
<canvas height="60px" width="100px" data-time="4.558893203735352"></canvas>
<canvas height="60px" width="100px" data-time="5.411310195922852"></canvas>
</section>
The code that I use is the following:
document.getElementById('videos').addEventListener('change',function(e){
var canvasElements=document.getElementById('thumbnails').getElementsByTagName('canvas');
for(var i=0;i<canvasElements.length;i++){
document.getElementById('thumbnails').removeChild(canvasElements[i]);
console.log('removed canvas');
}
},true);
However when the code runs, not all canvas are removed from that section and I don't even see the log statement in the console.
Go on this page, take some thumbnails, then switch to another video: http://laurent-tonon.com/VideoFinal/
I really don't get it...