Created
December 8, 2024 09:55
-
-
Save gerwld/6c733026f9f3576a7b5450e98b8915ec to your computer and use it in GitHub Desktop.
Trigger any event placed in IIFE / etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const element = temp1; | |
// Create a 'mouseenter' event | |
const event = new MouseEvent('mouseover', { | |
bubbles: true, // Ensures the event bubbles up (if needed) | |
cancelable: true, // Allows the event to be canceled | |
view: window // Links the event to the window object | |
}); | |
// Dispatch the event on the element | |
element.dispatchEvent(event); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment