myDocumentEvent.createEvent( eventType ) in DOM Level 2 Events
Creates and returns a new Event object.
Arguments
name | type | description |
---|---|---|
eventType | String | A string denoting the type of< |
- Return Type
- Event
Description
The eventType
argument is typically one of 'UIEvents', 'MouseEvents', 'MutationEvents', or 'HTMLEvents'. For many event types, you must call initEvent(...) before you pass the event object as a parameter to dispatchEvent(...).
var evt = document.createEvent('HTMLEvents');
evt.initEvent('change',true,true);
document.getElementById('foo').dispatchEvent( evt );