jQuery off() Method

The off() method in jQuery is used to remove event handlers attached with the on() method.


The syntax is as follows −


Above, the event parameter specifies one or more events or namespaces to remove from the selected element(s), function(eventOb) is the function to run when the event occurs. The map parameter is the event map.


Let us now see an example to implement the jQuery off() method 

 Live Demo

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
      $("p").on("click", function(){
         $(this).css("font-size", "1.5em");
<h2>Demo Heading</h2>
<p>Click here to change the font size</p>


This will produce the following output −

Click on the text to change the font size −

Now, run the script again. Click “Remove” to remove the event handler. After removing, when you will click on “Change”, then the font size won’t change −