Method: Document.createEvent()
The createEvent() method creates a new Event object of the given type.
If the event is to be dispatched via Node.dispatchEvent(), then the appropriate initialization method must be called after the event has been created, and before it is dispatched, in order to initialize the event’s values.
This method is used to create events when it is inconvenient or unnecessary for the user to create an event themselves.
Exceptions
Exception |
Description |
|---|---|
NOT_SUPPORTED_ERR |
This error is thrown if the implementation does not support the specified Event interface. |