Visit Mozilla.org

DOM:event.initEvent

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

The initEvent method is used to initialize the value of an event created using document.createEvent.

[edit] Syntax

event.initEvent(type, bubbles, cancelable) 
type 
The type of event.
bubbles 
A boolean indicating whether the event should bubble up through the event chain or not (see bubbles).
cancelable 
A boolean indicating whether the event can be canceled (see cancelable).

[edit] Example

// create a click event that bubbles up and 
// cannot be canceled 
event.initEvent("click", true, false);

[edit] Notes

Events initialized in this way must have been created with the document.createEvent method. initEvent must be called to set the event before it is dispatched.

[edit] Specification

DOM Level 2 Events: Event.initEvent