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/baks/pood/script.js | |
parent | 1add8ef6285df97270dae4df9f68591443fc5925 (diff) |
Sissejuhatus Btn clean
Diffstat (limited to 'rannak/mangud/arimees/baks/pood/script.js')
-rwxr-xr-x | rannak/mangud/arimees/baks/pood/script.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/rannak/mangud/arimees/baks/pood/script.js b/rannak/mangud/arimees/baks/pood/script.js new file mode 100755 index 0000000..3b3e67b --- /dev/null +++ b/rannak/mangud/arimees/baks/pood/script.js @@ -0,0 +1,69 @@ +document.addEventListener('DOMContentLoaded', () => { + let btn = document.querySelector('.modalButton'); + btn.click(); +}); + + + +const kurss = 15.6; +doneCounter = 0; + + +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(); + } + } + + + 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!"; + + } + + + + }) +} + + + +function enableAllGood(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = ""; +} |