Hello Readers,
In jquery chaining is the technique and most poweful feature. It means we chain the one or more methods or events to one selectors or elemnts.
Because of this it short the code level as well as its performance (means it gives betttr performance).
When we use the chaining into the jquery code we start from left to right . So, the left most will be considered first in jquery chaining.
Using this browers do not have to find the same elemnet again and again (means not find more than once).
Code Example :
$(document).ready(function(){
$('#dvContent').addClass('dummy');
$('#dvContent').css('color', 'red');
$('#dvContent').fadeIn('slow');
});
Above jQuery code sample can be re-written using chaining.
$(document).ready(function(){
$('#dvContent').addClass('dummy')
.css('color', 'red')
.fadeIn('slow');
});
0 Comment(s)