You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
57 lines
1.6 KiB
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>JS ForEach</title>
|
|
<link rel="stylesheet" href="css/bootstrap.css">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
|
|
<h1 class="mt-3">JS ForEach</h1>
|
|
|
|
<h4>Práce s ForEach bez využití bootstrapu</h4>
|
|
<div id="seznam"></div>
|
|
<hr>
|
|
|
|
<h2 class="text-center mb-2">Seznam úkolů</h2>
|
|
<ul class="list-group" id="seznam-ukolu"></ul>
|
|
|
|
<hr>
|
|
<h2 class="text-center mb-2">Produkty</h2>
|
|
<div class="row" id="produkty-row">
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<script>
|
|
const polozky = ["i3","i5","i7","i9"];
|
|
const seznam = document.getElementById("seznam");
|
|
polozky.forEach((polozka,index) => {
|
|
let li = document.createElement("p");
|
|
li.textContent = index+". je " +polozka;
|
|
seznam.appendChild(li);
|
|
})
|
|
|
|
console.log("------------------------------------------");
|
|
|
|
const ukoly = ["Nakoupit", "Uklidit", "Ucit se na WTL", "pripravit se na maturitu", "odpočinout si", "jit ven"];
|
|
const seznam2 = document.getElementById("seznam-ukolu");
|
|
|
|
ukoly.forEach(ukol => {
|
|
const li = document.createElement("li");
|
|
li.classList.add("list-group-item");
|
|
li.classList.add("text-center")
|
|
li.textContent = ukol;
|
|
seznam2.appendChild(li);
|
|
})
|
|
|
|
|
|
|
|
|
|
</script>
|
|
<script src="js/script.js"></script>
|
|
</body>
|
|
</html>
|