callbacks.disable() JQ Home  <<  Objects  <<  callbacks.disable()

Disable a callbacks list.


The callbacks.disable() Callbacks object method, disables a callback list.


Signature Description
callbacks.disable()Disable a callback list.





callbacks.disable() Example Objects  <<  Top

Disable a callback list.

In the example below when we press the button the first time we add the aFunc(value, div) function to our callbacks list and then fire the list off. After this we disable the list and then try to add and fire the bFunc(value, div) function. Because the callback list is now disabled nothing happens.

  $('#btn7').one('click', function(){
    var ourCallbacks = $.Callbacks();
    ourCallbacks.add( aFunc ); 'The aFunc function was fired from our callbacks. <br>', '#div7');
    ourCallbacks.add( bFunc ); 'The bFunc function was fired from our callbacks. <br>', '#div7');
  function aFunc( value, div ){
    $(div).append( value);
  function bFunc( value, div ){
    aFunc('Passing bFunc function value to aFunc. <br>', div);

div7. Some initial text.

Press the button below to action the above code:

Related Tutorials

jQuery Advanced Tutorials - Lesson 6 - The Callbacks Object