H
H
holfizz2022-04-20 12:39:46
JavaScript
holfizz, 2022-04-20 12:39:46

Why is [object HTMLButtonElement] displayed instead of text?

Here is the code:

let a = document.querySelector('.a'),
    b =  document.querySelector('.b'),
    c =  document.querySelector('.c');
const input = document.querySelector('.input')
let array = [a,b,c]
let pup = []
for (let element of array) {
    element.addEventListener('click', ()=>{
        pup.push(element)
        console.log(pup.join(''))
    })
}

What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Levsha1337, 2022-04-20
@Levsha1337

element.value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question