Chaining in jQuery
In fact chaining is more easy than you would think, the key is to define methods inside an object. Let’s have a look at a typical jQuery example, $(“.blabla”).addClass(“test”). $(“.blabla”) is in fact a call to the function jQuery(). The key to get your chaining going is to understand that jQuery() is an object with methods that you can call directly using the dot notation.
A very simple example of how you could do chaining
Not that hard after all