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
How to divide a page into parts using jquery mobile? : jquery mobile
How to submit a form without submit button using jquery?
What is a cdn? : jQuery Mobile
How To Use Ajax In Jquery?
Create a plugin that would add and remove a class on hover.
How can we show and hide an element via jquery?
What is jquery.size()? : jquery mobile
What are the methods used to provide effects?
What is the difference between the id selector and class selector in jquery?
Explain some of the key concepts of good code organization patterns.
Define the script build up by jquery?
How to programmatically trigger a click event that's being handled by jquery?
Can we add more than one ‘document.ready’ function in a page?
differentiate between bind() vs live() vs delegate() methods in jquery.
How to search for descendant elements that match the specified selectors using ?