Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is chaining in jQuery?

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


Please Help Members By Posting Answers For Below Questions

Have any of your startup projects failed dismally - if so, why and how did you learn from them?

780


Explain width() vs css(‘width’)?

711


Differentiate between jquery.size and jquery.length? : jQuery Mobile

788


What is the minimum setup needed to start using jquery.

811


What is jquery mobile theming? : jquery mobile

784


Define jquery filter?

797


What is jquery.noconflict? Explain

752


Explain the use of the .pushstack() method.

786


How can we apply css in even childs of parent node using jquery library?

817


Tell me what are the slow selectors in jquery? : jquery mobile

719


Is jquery a framework?

746


How to programmatically trigger a click event thats being handled by jquery only?

762


What is jquery connect and how to use it?

881


How can related code be encapsulated? Give example.

731


What are the methods used to provide effects in jquery?

698