Trigger function without jQuery
const trigger = (element, eventName) => {
let event;
if (document.createEvent) {
event = document.createEvent("HTMLEvents");
event.initEvent(eventName, true, true);
} else {
event = document.createEventObject();
event.eventType = eventName;
}
event.eventName = eventName;
(document.createEvent) ?
element.dispatchEvent(event) :
element.fireEvent("on" + event.eventType, event);
};