click button by javascript code example
Example 1: javascript onclick event listener
document.getElementById("myBtn").addEventListener("click", function() {
alert("Hello World!");
});
Example 2: javascript click button by id
var button = document.getElementById("button");
button.click();
Example 3: javascript click
const element = document.querySelector('element');
element.click();