Answers for "javascript get element by id click"

0

javascript click button by id

var button = document.getElementById("button");
button.click();
Posted by: Guest on May-20-2020
0

get element by click

window.onclick = e => {
    console.log(e.target.innerText);
}
Posted by: Guest on April-08-2021
0

get element by click

window.onclick = e => {
    console.log(e.target);  // to get the element
    console.log(e.target.tagName);  // to get the element tag name alone
}
Posted by: Guest on April-08-2021

Code answers related to "javascript get element by id click"

Code answers related to "Javascript"

Browse Popular Code Answers by Language