jQuery | chaining() Last Updated : 27 Apr, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report jQuery is a very powerful framework of JavaScript. With jQuery, we can use do chaining which means to chain together multiple methods in a single statement on a single element. We have been using a single statement at once, but now using the chaining method we can bind multiple methods to make the code short. This way, browsers do not have to find the same element(s) more than once. Advantage: While using method chaining in jQuery, it ensures that there is no need to use the same selector more than once. Over-using a selector can seriously slow down your code, as every time you call on a selector you are forcing the browser to go looking for it. By combining or "chaining" multiple methods, you can seriously cut down on the number of times you make your browser look for the same elements without having to set any variables. Implementation of chaining() using JavaScript and jQuery for better understanding: Code #1: Using Slide up and slide down method functions for chaining- javascript <!DOCTYPE html> <html> <head> <script src=" https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <body> <p id="para">Chaining method in jQuery</p> <button>Click me</button> <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { //assigning the color blue $("#para").css("color", "blue") //using slide up method .slideUp(2000) //using slide down method .slideDown(2000). slideUp(2000). slideDown(4000); }); }); </script> </body> </html> Output: Code #2: Using animate function in jQuery for chaining effect- html <!DOCTYPE html> <html> <head> <script src=" https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <body> <p id="para">Chaining method in jQuery</p> <button>Click me</button> <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { $("#para").css("color", "blue").animate({ width: "100%" }) //it adds animation to the program by styling it .animate({ fontSize: "46px" }) .animate({ borderWidth: 30 }); }); }); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article jQuery | chaining() R revantjain Follow Improve Article Tags : JQuery Similar Reads What is chaining in jQuery ? In jQuery, chaining allows us to perform multiple operations on an element in a single statement. Most of the jQuery function returns a jQuery object and due to this when the first method completes its execution, it returns an obj now the second method will be called on this object. Example 1: With 2 min read How to use Method Chaining in jQuery ? jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating the terms simplifies HTML document traversing, manipulation, browser event handling, DOM animations, AJAX interact 2 min read jQuery callbacks.fire() Method The jQuery callbacks.fire() method is used to call all the callbacks with the given arguments in the list. This method returns the callbacks object onto which it is attached (this). Syntax:callbacks.fire( arguments )Parameters:arguments: This parameter defines the argument or list of arguments to pa 2 min read jQuery callbacks.fireWith() Method The callbacks.fireWith() method in jQuery is used to call all the callbacks which are currently in the list with the given context and parameters.Syntax:callbacks.fireWith([context][, params])Parameters:context: This parameter defines the reference to the context in which the callbacks in the list s 2 min read jQuery | extend() method This extend() Method in jQuery is used to merge the contents of two or more objects together into the first object. Syntax: jQuery.extend( [deep ], target, object1 [, objectN ] ) Parameters: The extend() method accepts four parameter that is mentioned above and described below: deep: This parameter 2 min read Like