I have some performance problems with jQuery. Therefore I want to try my loop with the lenght of 7000 with JS than jQuery. Because I read, that jQuery has always very bad performance.
I tried to convert my jQuery Selector to JS, but it stills not working:
from:
var i;
for (i = 0; i < e.detail.length; i++){
$("iframe").contents().find(".timeline-node[title='" + i + "']").css("background-image", "url( \"imgs/" + e.detail[i] + ".png \") ");
}
to :
var i;
for (i = 0; i < e.detail.length; i++){
document.getElementById('#iframe').querySelector("[title=\"" + i + "\"]").css("background-image", "url( \"imgs/quality_3/" + e.detail[i] + ".png \") ");
}
The error of my new code is: Cannot read property 'querySelector' of null at HTMLDocument. I think JS cannot find my title with attr. i. But my code with jQuery works very well, but it takes 80sec. to do it for 7000 indexes.