39 lines
1.5 KiB
HTML
39 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
|
|
<title>Document</title>
|
|
</head>
|
|
<body>
|
|
<select id="opciok"></select>
|
|
<div id="opciok2"></div>
|
|
<script>
|
|
let tomb = ["tejtermék", "pékáru", "édesség", "fűszer", "tisztítószer"];
|
|
let opciok = document.getElementById("opciok");
|
|
let count = 0;
|
|
for (let item of tomb) {
|
|
let option = document.createElement("option");
|
|
option.innerText = item;
|
|
option.value = count++;
|
|
opciok.appendChild(option);
|
|
}
|
|
|
|
count = 0;
|
|
for (let elem of tomb) {
|
|
let radioB = document.createElement("input");
|
|
radioB.setAttribute("type", "radio");
|
|
radioB.value = count++;
|
|
let szoveg = document.createElement("label");
|
|
szoveg.innerText = elem;
|
|
let br = document.createElement("br");
|
|
document.getElementById("opciok2").appendChild(radioB);
|
|
document.getElementById("opciok2").appendChild(szoveg);
|
|
document.getElementById("opciok2").appendChild(br);
|
|
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |