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
Do we need to add jQuery file in both Master and Content page?
What does dollar sign ($) means in jquery? : jquery mobile
How can jquery library be added to pages? Write a basic jquery code?
Explain .on()? : jquery mobile
What is .remove()? : jquery mobile
How we can hide a block of html code on a button click using jquery?
List a few features of jquery mobile? : jQuery Mobile
What is .detach()? : jquery mobile
What is jquery datepicker in jquery?
Whether jQuery HTML work for both HTML and XML documents?
What is the need for jquery? : jQuery Mobile
Why should I use jquery?
List the advantage of using minimized version of jquery?
What does jQuery data() function do?
How to include jquery library in asp.net project?