Skip to content

triggerEvent

triggerEvent(element, type, bubbles?): void

Defined in: core/dom/events.ts:128

Dispatches a plain event, as the browser does for its own (change, click, …). It bubbles unless bubbles is false, and it carries no data: use customEventTrigger for that.

new Event() does not exist in IE10, so the event is made with document.createEvent().

EventTarget

Element, document or window to dispatch on.

string

Event type, e.g. change.

boolean

Whether the event bubbles. Defaults to true.

void

select.selectedIndex = 2;
triggerEvent(select, 'change');