summaryrefslogtreecommitdiff
path: root/rannak/mangud/direktor/baltikett/script.js
blob: 5d58c87a761f298bc3d5cd29500dd0d77824929a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
document.addEventListener('DOMContentLoaded', () => {
    let btn = document.querySelector('.modalButton');
    btn.click();
});



const inputs = document.querySelectorAll('input');
let asulaVal;
let kaugusVal;
let teekondVal;

for (input of inputs){
    input.addEventListener('input', () => {
        getInputs()
    });
}


function getInputs(){
    let teekond = document.querySelector('.teekondInput');
    let asula = document.querySelector('.asulaInput');
    let kaugus = document.querySelector('.kaugusInput');

    asulaVal = asula.value;
    kaugusVal = kaugus.value;
    teekondVal = teekond.value;

    if (asulaVal != '' && kaugusVal != '' && teekondVal != '')
        allGood();
}



/// All Done ///



function allGood(){
    const btn = document.querySelector(".moveOn");
    btn.disabled = false;
    localStorage.setItem("asula", asulaVal);
    localStorage.setItem("kaugus", kaugusVal);
    localStorage.setItem("teekond", teekondVal);
    btn.onclick = () => location.href = "../loosung";
}