I want to render Images with JavaScript into my HTML-File. I can't find the problem, here is my code from the JavaScript and the HTML. Really appreciate when someone can help me.
Than you!
const imgs = [
"images/p1.jpg",
"images/p2.jpg",
"images/p3.jpg"
]
const container = document.getElementById("container")
function renderImages() {
let getImgs = ""
for (let i = 0; i < imgs.length; i++) {
getImgs = `<img scr="${imgs[i]}">`
}
container.innerHTML = getImgs
}
renderImages()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Headline</h1>
<div id="container">
</div>
<script src="index.js"></script>
</body>
</html>