0

Basically what iam confused of and not finding: I thought there is a way i can use Bootstrap as a basic layout and then JS to make a loop to insert all my photo files to the html page.

but i cant find anything

My Photos in a folder and named: 1 (1).jpg, 1 (2).jpg, 1 (3).jpg and so on and it goes on to like 350.

my IDEA: make an array which autoamtically generates for me the strings 1 (1).jpg till 1 (350).jpg.

then use it in a loop and do it like (simple IDEA):

let arr = all the strings :)

for (let i=0; i<arr.length; i++){
$(".container").append(<img src="arr[i]" alt="arr[i]>)
};

1) What do you think
2) how can i create this array automatically
  • you need to have the images in a folder accessible to the outside world, check https://stackoverflow.com/questions/18480550/how-to-load-all-the-images-from-one-of-my-folder-into-my-web-page-using-jquery – tHeSiD Jun 19 '20 at 19:12
  • thanks. but how to implement it ? if i did it with javascript (loaded at end of body) i get this message in the console : test.js:3 Uncaught TypeError: $.ajax is not a function at test.js:3 - i use VSC live server – Tomerson Jefferson Jun 19 '20 at 19:20
  • if the strings are uniform then use a [template string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals), rather than an array – Matt Ellen Jun 19 '20 at 20:48

0 Answers0