The jQuery callbacks.fired() method is used to check if the callbacks have already been called at least once. This method returns the boolean value.
Syntax:
callbacks.fired()
Parameters: This method does not accept any arguments.
Return Value: This method returns a Boolean value.
Example 1: This example returns true because the fire() method has been called at least once.
<!DOCTYPE HTML> <html> <head> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> JQuery | callbacks.fired() method </p> <button onclick="Geeks();"> click here </button> <p id="GFG_DOWN"></p> <script> var el_down = document.getElementById("GFG_DOWN"); var res = ""; var callbacks = jQuery.Callbacks(); function Geeks() { // First function to be added to the list var fun1 = function (val) { res = res + "This is function 1 and" + " value passed is " + val + "<br>"; }; // Adding the function 1 callbacks.add(fun1); // Calling with "GFG_1" callbacks.fire("GFG_1"); // Calling callbacks.fired() // method to get true el_down.innerHTML = callbacks.fired(); } </script> </body> </html> |
Output:

Example 2: This example returns false because the fire() method hasn’t been called.
<!DOCTYPE HTML> <html> <head> <script src= </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> JQuery | callbacks.fired() method </p> <button onclick="Geeks();"> click here </button> <p id="GFG_DOWN"></p> <script> var el_down = document.getElementById("GFG_DOWN"); var res = ""; var callbacks = jQuery.Callbacks(); function Geeks() { // First function to be added to the list var fun1 = function (val) { res = res + "This is function 1 and" + " value passed is " + val + "<br>"; }; // Adding the function 1 callbacks.add(fun1); // Adding again callbacks.add(fun1); // Calling callbacks.fired() but // This time we will get false el_down.innerHTML = callbacks.fired(); } </script> </body> </html> |
Output:

Recommended Posts:
- JQuery | map() Method
- jQuery | add() method with Example
- jQuery | before() Method
- jQuery | get() Method
- JQuery | now() method
- jQuery odd() Method
- JQuery when() method
- jQuery | die() Method
- jQuery | css() Method
- jQuery | is() Method
- jQuery even() Method
- JQuery sub() method
- jQuery | contains() Method
- jQuery | off() Method
- jQuery UI | toggle() Method
- jQuery UI | toggleClass Method
- jQuery UI | switchClass() Method
- JQuery | inArray() method
- jQuery | grep() Method
- jQuery | ajaxComplete() 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.

