1
Using pure javascript, I wanted to click a button and trigger its events, but the important thing is that I don’t want to call the function directly. So far I’ve tried it:
var send = document.getElementsByName("send");
window.addEventListener("keyup", function( e ){
    if(e.which == 13 || e.keyCode == 13){
        send.dispatchEvent(new Event('click'));
    }
});
I’ve searched several articles, but I need the equivalent of jQuery element.click();, but the articles only teach to call the function directly connected to the element.
<button name="send" onclick="alert('foo')">Enviar</button>
Using pure javascript, how do I click on that button without being directly or calling the function that is on onclick
Try to better detail your goal
– Paulo Coghi