Open In App
Related Articles

HTML DOM createEvent() Event Method

Improve Article
Save Article
Like Article

The createEvent() method in HTML creates an event object of the specified type. The created event must be initialized before use. 



event_type: It is the required parameter and is used to specify the type of event. There are many types of events which are listed below:


Example: Below program illustrates the createEvent() method in HTML.


<!DOCTYPE html>
        DOM createEvent() Event Method
        div {
            padding: 50px;
            text-align: center;
            background-color: green;
            color: white;
        document.body.onclick = function () {
                = "Welcome to GeeksforGeeks!";
        let onClick = function () {
            let evt = document.createEvent("MouseEvents");
                ("click", true, true, window, 0, 0, 0, 0,
                    0, false, false, false, false, 0, null);
    <div id="Geeks"></div>



Supported Browsers: The browser supported by DOM createEvent() method are listed below:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 9
  • Firefox 1
  • Opera 7
  • Safari 1

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 09 Jun, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials