Example of callbacks.remove() in jQuery
March 30, 2013
remove() in jQuery removes the callback function from the callback list. Once removed then no fire() will execute the callback method. Find the syntax below.
callbacks.remove()
<html> <body> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> var show = function( val ) { console.log(val); }; var callbacks = $.Callbacks(); callbacks.add( show ); callbacks.fire("Hellow"); callbacks.remove(show); callbacks.fire("World!"); </script> </body> </html>
Output
Hellow