click the button from function code example
Example: javascript onclick button
var button = document.querySelector('button');
button.onclick = function() {
//do stuff
}
var button = document.querySelector('button');
button.onclick = function() {
//do stuff
}