<button>Button</button>
//creating new event var event = new Event("customAction"); //assigning the event handler to a object document.querySelector("button").addEventListener("customAction", function() { document.querySelector("button").innerHTML = "Event Triggered"; }, false); //calling the event handler manually document.querySelector("button").dispatchEvent(event);