top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is Chaining in jQuery?

+5 votes
449 views

Explain with sample code.

posted Feb 24, 2014 by Asmita Agrawal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

With jQuery, you can chain together actions/methods. Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.

jQuery Method Chaining
Chaining allows us to run multiple jQuery commands, one after the other, on the same element(s). (This way, browsers do not have to find the same element(s) more than once.)

To chain an action, you simply append the action to the previous action.

$("#p1").css("color","red").slideUp(2000).slideDown(2000);
answer Feb 25, 2014 by Salil Agrawal
...