trigger event code example
Example 1: trigger event javascript
// Simple trigger event
document.querySelector(theElem).dispatchEvent(new Event('mouseover'))
Example 2: trigger send parameter
$('body').trigger('this_works', [{data: [1, 2, 3]}, 'something']);
$('body').on('this_works', function (event, json, string) {
// parameter is stocked in json.data here.
console.log(event, json, string);
});