Answer Posted / chaitanya
Chaining is one of the most powerful feature of jQuery. In jQuery, Chaining means to connect multiple functions, events on selectors. It makes your code short and easy to manage and it gives better performance. The chain starts from left to right. So left most will be called first and so on.
Hide Copy Code
$(document).ready(function(){
$('#dvContent').addClass('dummy');
$('#dvContent').css('color', 'red');
$('#dvContent').fadeIn('slow');
});
The above jQuery code sample can be re-written using chaining. See below.
Hide Copy Code
$(document).ready(function(){
$('#dvContent').addClass('dummy')
.css('color', 'red')
.fadeIn('slow');
});
Not only functions or methods, chaining also works with events in jQuery. Find out more here.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between $(window).load and $(document).ready?
Tell me is jquery a library for client scripting or server scripting? : jquery mobile
Why is jquery better than javascript?
What is the advantage of using minimized version of jQuery?
What is the use of serialize method in jQuery?
Which program is useful for testing jQuery?
What is the use of the animate() method in jquery?
Define cdn in jquery?
Explain jquery connect?
Which are the fastest selectors in jquery? : jquery mobile
What are the various ajax functions available in jquery ?
Does jquery follow w3c recommendations?
How to find all sibling elements in front of the current element using ?
How to run an event handler only once in jQuery?
What is the use of noconflict() method in jquery?