The jQuery callbacks.remove() method is used to remove a single callback or a collection of callbacks from a callback list.
Syntax:
callbacks.remove( callbacks )
Parameters:
- callbacks: This parameter specifies a function, or an array of functions, which are to be removed from the callback list.
Return Value: This method returns the Callbacks object onto which it is attached.
Example 1: In this example, there is a remove method used to remove the function ‘func’ from the list.
html
<!DOCTYPE HTML> <html> <head> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> jQuery | callbacks.remove() method </p> <button onclick="Geeks();"> click here </button> <p id="GFG"></p> <script> var el_down = document.getElementById("GFG"); var res = ""; var callbacks = jQuery.Callbacks(); function Geeks() { var func = function (val) { res = res + "value passed is - " + val; }; // Function added to list callbacks.add(func); callbacks.fire("gfg_1"); // Removing the func from list callbacks.remove(func); // Now This will not work callbacks.fire("gfg_2"); el_down.innerHTML = res; } </script> </body> </html> |
Output:

Example 2: This example provides a button to remove the function ‘fun’ from the Callbacks list.
html
<!DOCTYPE HTML> <html> <head> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> JQuery | callbacks.remove() method </p> <button onclick="Geeks();"> click here </button> <button onclick="remove();"> remove </button> <p id="GFG"></p> <script> var el_down = document.getElementById("GFG"); var res = ""; var callbacks = jQuery.Callbacks(); var fun = function (val) { res = res + "This is function and " + "value passed is " + val + "<br>"; }; // Adding function to Callback list callbacks.add(fun); // Defining function to remove function remove() { callbacks.remove(fun); } function Geeks() { callbacks.fire("GFG_1"); el_down.innerHTML = res; } </script> </body> </html> |
Output: Function is removed from callbacks list.

Recommended Posts:
- jQuery | jQuery.fx.interval Property with example
- jQuery | jQuery.fx.off Property
- jQuery | jQuery.support Property
- jQuery | jquery Property
- jQuery UI | position() Method
- JQuery | parseHTML() method
- jQuery | css() Method
- jQuery | add() method with Example
- jQuery | not() method with Examples
- jQuery | ajaxStart() Method
- JQuery UI | Progressbar method
- jQuery | get() Method
- jQuery | fadeIn() Method
- jQuery | delegate() Method
- jQuery | outerHeight() Method
- jQuery | event.isDefaultPrevented() Method
- jQuery | outerWidth() Method
- jQuery | before() Method
- jQuery | off() Method
- jQuery | html() Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

