diff options
author | Rasmus <rasmus.luha@gmail.com> | 2023-05-06 12:09:56 +0300 |
---|---|---|
committer | Rasmus <rasmus.luha@gmail.com> | 2023-05-06 12:09:56 +0300 |
commit | 3c64a840a69b2685722765feadf0fec6e571b157 (patch) | |
tree | eab06f3eeccd6a31c5fdf2aa78a6e68eeddecc85 /rannak/mangud/arimees/muusika/script.js | |
parent | 8f3d2b1b6ff3cb2378a2ce5403faebaadca61c11 (diff) |
fixed vids and else
Former-commit-id: d0b098f6e7522ec2791cb3786f3b7926d9b1aae1
Diffstat (limited to 'rannak/mangud/arimees/muusika/script.js')
-rw-r--r-- | rannak/mangud/arimees/muusika/script.js | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/rannak/mangud/arimees/muusika/script.js b/rannak/mangud/arimees/muusika/script.js index 0bcaae0..85d0292 100644 --- a/rannak/mangud/arimees/muusika/script.js +++ b/rannak/mangud/arimees/muusika/script.js @@ -4,8 +4,12 @@ document.addEventListener('DOMContentLoaded', () => { }); -const selectors = document.querySelectorAll('select'); +allPohjendatud = false; +allSelected = false; + +// EventListenres +const selectors = document.querySelectorAll('select'); for(el of selectors){ el.addEventListener('change', () => { @@ -16,13 +20,46 @@ for(el of selectors){ } if (selected.length == 6) + allSelected = true; + else + allSelected = false; + + if (allPohjendatud && allSelected) + moveOnEnable(); + }); +} + + + +const pohjendused = document.querySelectorAll('textarea'); +for(el of pohjendused){ + el.addEventListener('input', () => { + + let pohjendatud = new Array(); + for (el of pohjendused){ + if (!pohjendatud.includes(el) && el.value != '') + pohjendatud.push(el); + } + + if (pohjendatud.length == 6) + allPohjendatud = true; + else + allPohjendatud = false; + + if (allPohjendatud && allSelected) moveOnEnable(); }); } -// If All Else Done + + + + + + +// If All Done function moveOnEnable(){ const btn = document.querySelector(".moveOn"); |