XML DOM dispatchEvent() method

Definition and usage

The dispatchEvent() method dispatches a synthetic event to the node.

Syntax:

dispatchEvent(evt)
Parameter Description
evt is required. The Event object to be dispatched.

Return value

If the event propagation process called evt of preventDefault() method, then return false, otherwise return true.

throws

If the Event object evt Not initialized, or its type attribute is null or empty, the method will throw an exception.

Description

This method will dispatch a synthetic event, which is Document.createEvent() Create, initialized by an initialization method defined by the Event interface or one of its child interfaces.

The node that calls this method becomes the target node of the event, which is the first to propagate down the document tree at the capture phase. If the bubbles attribute of the event is true, then after the event is handled by the target node itself, it will bubble up along the document tree.