jQuery Mobile Question:
Download Questions PDF

Explain chaining in jQuery?


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.

$('#dvContent').css('color', 'red');

The above jQuery code sample can be re-written using chaining.

.css('color', 'red')

Not only functions or methods, chaining also works with events in jQuery

Download jQuery Mobile Interview Questions And Answers PDF

Previous QuestionNext Question
Can we include multiple version of jQuery?Tell me how to write browser specific code using jQuery?