diff options
author | Rasmus <rasmus.luha@gmail.com> | 2023-03-13 16:33:45 +0200 |
---|---|---|
committer | Rasmus <rasmus.luha@gmail.com> | 2023-03-13 16:33:45 +0200 |
commit | c40293acd3a00b20d74cf37823b7efb1b75dec9b (patch) | |
tree | baae5261dae9549bdb24f74aa2249965ec183fbc /rannak/mangud/arimees/pood/script.js | |
parent | 1add8ef6285df97270dae4df9f68591443fc5925 (diff) |
Sissejuhatus Btn clean
Diffstat (limited to 'rannak/mangud/arimees/pood/script.js')
-rwxr-xr-x | rannak/mangud/arimees/pood/script.js | 65 |
1 files changed, 14 insertions, 51 deletions
diff --git a/rannak/mangud/arimees/pood/script.js b/rannak/mangud/arimees/pood/script.js index 3b3e67b..8803bbe 100755 --- a/rannak/mangud/arimees/pood/script.js +++ b/rannak/mangud/arimees/pood/script.js @@ -4,66 +4,29 @@ document.addEventListener('DOMContentLoaded', () => { }); +const selectors = document.querySelectorAll('select'); -const kurss = 15.6; -doneCounter = 0; +for(el of selectors){ + el.addEventListener('change', () => { - -const kontrollBtns = document.querySelectorAll(".kontrolliKaarti"); -for (let nupp of kontrollBtns){ - nupp.addEventListener("click", (e) => { - let rublaHind = e.target.previousElementSibling.children[0].children[1].innerHTML; - let pakkumine = e.target.previousElementSibling.children[1].children[1].value; - - if (pakkumine*kurss == rublaHind){ - - //Change color - e.target.offsetParent.style.background = "#288654"; - e.target.previousElementSibling.children[0].style.borderRight = ".5rem solid #288654"; - e.target.previousElementSibling.children[1].style.borderLeft = ".5rem solid #288654"; - - //Change Element - - (e.target.previousElementSibling.children[1].children[1]).remove(); - const newEl = document.createElement("span"); - newEl.classList.add("symbol"); - newEl.innerHTML = pakkumine + " M"; - e.target.previousElementSibling.children[1].appendChild(newEl); - - e.target.remove(); - doneCounter++; - - - // InfoTxt - let infoTxt = document.querySelector(".infoTxt") - infoTxt.innerHTML = ""; - - if (doneCounter >= 6){ - enableAllGood(); - } + let selected = new Array(); + for (el of selectors){ + if (!selected.includes(el.value) && el.value != 'Vali') + selected.push(el.value); } - - else{ - // Inputvalue Reset - e.target.previousElementSibling.children[1].children[1].value = ""; - - // InfoTxt - let infoTxt = document.querySelector(".infoTxt") - infoTxt.style.color = "red"; - infoTxt.innerHTML = "Proovi Uuesti!"; - - } - - - - }) + if (selected.length == 6) + moveOnEnable(); + + }); } +// If All Else Done -function enableAllGood(){ +function moveOnEnable(){ const btn = document.querySelector(".moveOn"); btn.disabled = false; btn.onclick = () => location.href = ""; } + |