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
Can we select a element having a specific class in jquery ?
How to use transition effects? : jQuery Mobile
Define the script build up by jquery?
Explain the difference between .empty() and .remove() ?
How do you select all elements with the class of “selected” in jquery?
How to divide a page into parts using jquery mobile? : jquery mobile
Define jquery filter?
Why jquery?
What are some of the ways to provide effects? : jQuery Mobile
What to do to select element having a particular class (".selected")? : jquery mobile
Which program is useful for testing jQuery?
How can I select 20th div with jquery?
How did you become the creator of jquery ui? Whats the story behind that?
Is jquery code exicuted on the clientside, or serverside?
What is get()? : jquery mobile