Proper use of jquery chain operations

  • 2020-03-30 01:12:25
  • OfStack

Bad use


$second.html(value);
$second.on('click',function(){
alert('hello everybody');
});
$second.fadeIn('slow');
$second.animate({height:'120px'},500);

Recommended usage


$second.html(value);
$second.on('click',function(){
alert('hello everybody');
}).fadeIn('slow').animate({height:'120px'},500);


Related articles: