javascript call event code example
Example 1: trigger event javascript
// Simple trigger event
document.querySelector(theElem).dispatchEvent(new Event('mouseover'))
Example 2: custom event js
const eventDetails = {
'id': elemId
}
document.dispatchEvent (
new CustomEvent('myCustomEvent', {'detail': eventDetails})
)