Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.2 kB
0
Indexable
Never
const button = document.querySelector('input[type=submit')
 
    const labels = Array.from(document.querySelectorAll('label'))
    // var houseNumberInput = 0
    labels.forEach(element => {
        // console.log(element.innerText)
        if(element.innerText.includes("Numer domu")){
            var houseNumberInput = element.firstElementChild
        }});
    // console.log(labels)
 
 
    // console.log(button)
    button.addEventListener('click', function(event){
        event.preventDefault()
 
        labels.forEach(element => {
            if(element.innerText.includes("Numer domu")){
                if(element.firstElementChild.value == parseInt(element.firstElementChild.value)){
                        console.log("działą")
                }
                else{
                    let msg =  document.createElement('p')
                    var test = document.createTextNode("to nie jest sama liczba");
                    msg.appendChild(test)
                    		document.getElementsByClassName('error_message')[0].appendChild(msg)

                }
 
           
            }
        });
    })