Open In App

jQuery callbacks.add() Method

Last Updated : 23 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The jQuery callbacks.add() method is used to add a callback or a collection of callbacks to a callback list. This method returns the callback object onto which it is attached (this).
Syntax: 

callbacks.add(callbacks)


Parameters: 

  • callbacks: This parameter holds a function, or an array of functions, that are to be added to the callback list.


Example 1: This method adds a method fun1() to the callback and call it. 

Output: 
 


Example 2: This example adds method fun1() and fun2() to the callbacks and then calls them. Notice that at second time the fire() method is called, it calls both the functions with the same argument 'GFG_2'.

Output: 



Next Article

Similar Reads