码迷,mamicode.com
首页 > Web开发 > 详细

jquery on

时间:2019-06-28 15:21:11      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:pass   query   lan   live   currently   attaching   value   bind   present   

https://api.jquery.com/on/

.on( events [, selector ] [, data ], handler )Returns: jQuery

Description: Attach an event handler function for one or more events to the selected elements.

  • version added: 1.7.on( events [, selector ] [, data ], handler )

    • events
      Type: String
      One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
    • selector
      Type: String
      A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
    • data
      Type: Anything
      Data to be passed to the handler in event.data when an event is triggered.
    • handler
      Type: Function( Event eventObject [, Anything extraParameter ] [, ... ] )
      A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
  • version added: 1.7.on( events [, selector ] [, data ] )

    • events
      An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
    • selector
      Type: String
      A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
    • data
      Type: Anything
      Data to be passed to the handler in event.data when an event occurs.

The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers. For help in converting from older jQuery event methods, see .bind(), .delegate(), and .live(). To remove events bound with .on(), see .off(). To attach an event that runs only once and then removes itself, see .one()

 

 

 

 

jquery on

标签:pass   query   lan   live   currently   attaching   value   bind   present   

原文地址:https://www.cnblogs.com/chucklu/p/11102329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!