DIV CSS 佈局教程網

高效 jQuery:善用鏈式操作
編輯:JQuery常見問題     

jQuery 實現方法的鏈式操作非常容易,善用這個特性可以讓程式碼更簡潔。

// 糟糕的寫法

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

// 建議的寫法

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

更多高效 jQuery 實踐經驗。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved