Dispatch Custom Event

by Jacob King

JavaScript

const btn = document.querySelector('#btn');

// Dispatch the custom event on the button when clicked
btn.addEventListener('click', () => {
  btn.dispatchEvent(evt);
});