DIV CSS 佈局教程網

jQuery on() 方法支援的事件整理
編輯:JQuery特效代碼     

自從 jQuery 推出 on() 與 off() 後,事件綁定與解除變得更統一。相比舊式 click() 寫法,on() 更適合處理動態加入的元素,也能清楚表達事件來源。

表單與焦點事件

  • blur
  • focus
  • focusin
  • focusout
  • change
  • select
  • submit

滑鼠事件

  • click
  • dblclick
  • mousedown
  • mouseup
  • mousemove
  • mouseover
  • mouseout
  • mouseenter
  • mouseleave
  • contextmenu

鍵盤與視窗事件

  • keydown
  • keypress
  • keyup
  • load
  • resize
  • scroll
  • unload
  • error

實際使用時,可以寫成 $('.button').on('click', function () { ... });。若元素是後續動態產生,也可使用事件委派,例如 $(document).on('click', '.button', function () { ... });。

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