The images in the directory training_images/class1
are frame 0 to 99.
for (var i = 0; i < 100; ++i){
$("#class1-images").prepend($('<img>',{id:'theImg',src:'training_images/class1/frame' + i + ".jpg"})
)}
So when I run this code, I do not see the images.
I need the images to be displayed.
I tried dragging the image into google chrome, and copied the path from there and pasted the URL in my code, but it’s still not working.
2
Answers
You are trying to select a tag
<img>
which doesn’t exist.$
is a jQuery function equivalent todocument.querySelector()
. Therefore, to select theimg
tag you simply need to replace the<img>
→img
. This is all what can be interpreted from the code provided by you!Final Code Compilation:
Your script should work – provided the target element exists and there are images behind the added URLs: