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 cdn and how jquery is related to it?
Explain deferred and promise object in jquery? : jquery mobile
What is the use of jQuery.data() method?
Tell me which command will give a version of jquery?
Why content injected into a page is not enhanced? : jquery mobile
What are jquery plugins?
What is the method used to define the specific character in place of $ sign?
What is the advantage of using minimized version of jQuery?
What is parseint() and why it is used?
Is it possible to use jquery to make ajax request? : jquery mobile
How to resolve conflicts with other libraries?
How do you install/use jquery in a project. What is the minimum setup needed to start using jquery.
Difference between javascript and jquery? : jQuery Mobile
What is the use of noconflict() method in jquery?
How do I check if an element is hidden in jQuery?