The createEvent() method in HTML creates an event object of the specified type. The created event must be initialized before use.
document.createEvent( event_type )
event_type: It is the required parameter and used to specify the type of event.
There are many type of events which are listed below:
Below program illustrates the createEvent() method in HTML:
Before Click on the element:
After Click on the element:
Supported Browsers: The browser supported by DOM createEvent() method are listed below:
- Google Chrome
- Internet Explorer