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

Explain the starting point of code execution in jquery? : jquery mobile

835


Why do we need to go for JQuery?

861


What is the difference between jquery.get() and jquery.ajax()?

953


With jquery ui 1.7 being released in the last few days, what do you see as the key parts of jquery ui 1.7? What are you most proud of out of that release?

968


Why content injected into a page is not enhanced? : jquery mobile

827


How to add and remove css classes to an element using ?

894


Can you please explain the difference between prop and attr? : jquery mobile

780


explain width() vs css(‘width’) in jquery

855


What is jquery.length? : jquery mobile

887


Difference Between Prop and Attr in jQuery?

873


What is event preventdefault () and event stoppropagation () in jquery?

784


Tell me how to check if number is numeric while using jquery 1.7+? : jquery mobile

971


What is the use of delay() method in JQuery?

929


Explain the difference between onload() and document.ready() function used in jquery?

836


What is parent() in jquery?

876