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
Explain how jquery works?
Differentiate between calling stop (true, true) and finish method?
Define width() vs css('width')?
What features of jquery, has been used in web applications?
What is resize() function in jquery?
Explain the difference between body onload() and document.ready() function? : jquery mobile
How to multiple AJAX requests be run simultaneously in jQuery?
What is the use of jquery.data()?
Is jquery a framework?
What is the use of queue() in jquery?
Which one is more efficient, document.getelementbyid( "idname") or $("#idname)?
What is the latest version of jquery?
How can we apply css in div using jquery?
What is the difference between size and length of jQuery?
What are selectors in jquery mean ?