Open In App
Related Articles

HTML DOM removeEventListener() Method

Improve Article
Save Article
Like Article

The removeEventListener() method is used to remove an event handler associated with the addEventListener() method. This method of removing event handler can be used only with the addEventListener() method specified using an external function. Syntax:

element.removeEventListener(event, function, useCapture);

Parameters: This function accepts three parameters as described below:

  • event: The parameter event specifies the name of the event to be removed.
  • function: The parameter function specifies the function to be removed.
  • useCapture: The parameter useCapture denotes the event phase to be removed from the event handler. If useCapture has the boolean value true, it removes the event handler from the capturing phase else it removes the event handler from the bubbling phase.

Example: In the below example, calls event handler which changes the color of the division tag on mousemove over division. After pressing the change color button, the event handler associated with the division tag gets removed and no color change appears on mousemove over division. 


<!DOCTYPE html>
        #myDIV {
            border: 1px solid;
            padding: 50x;
            color: black;
    <div id="myDIV">
        <button onclick="removeHandler()" id="myBtn">
            Change color
            .addEventListener("mousemove", myFunction);
        function myFunction() {
                        .style.color= "green";
        function removeHandler() {
            .removeEventListener("mousemove", myFunction);


Before Pressing Button: 


After Pressing Button: 


Supported Browsers: The browsers supported by removeEventListener() method are listed below:

  • Google Chrome 1.0
  • Edge 12.0
  • Internet Explorer 9.0
  • Firefox 1.0
  • Opera 7.0
  • Safari 1.0

Last Updated : 13 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials