document.trigger

document.trigger(evtName, options)

evtNameA string containing a JavaScript event type, such as click or submit.

optionsAdditional parameters to pass along to the event handler { once: true, passive: true, capture: true } once => true, the event can only be called once, polyfill for IE

Execute all handlers and behaviors attached to the matched elements for the given event type.

<script> var fn = function() { alert("clicked"); } document.trigger("click"); </script>