Looking for a full list of jQuery event types

后端 未结 5 2082
滥情空心
滥情空心 2020-12-04 23:38

Where I can find a complete list of all jQuery supported events (like click, mouseup etc) with some explanations when they are triggered? I am look

相关标签:
5条回答
  • 2020-12-04 23:51

    A non exhaustive list is at http://api.jquery.com/category/events/. There are more DOM events supported through .bind() and .live(). Those functions can assign a handler to any standard DOM event, most of which are listed along with compatibility tables at http://www.quirksmode.org/dom/events/

    The .bind() method is the primary means of attaching behavior to a document. All JavaScript event types, such as focus, mouseover, and resize, are allowed for eventType.


    As of jQuery 1.7, you should use .on() in place of .live() and .bind().

    0 讨论(0)
  • 2020-12-04 23:53

    You can check out the full list of jQuery events: http://api.jquery.com/category/events/

    But regarding the paste event you mentioned, jQuery can also bind to standard DOM events. A good list is provided by MDN https://developer.mozilla.org/en-US/docs/Web/Events

    0 讨论(0)
  • 2020-12-05 00:08

    MDN has a good overview of majority of the standard and non-standard events

    https://developer.mozilla.org/en-US/docs/Web/Reference/Events

    0 讨论(0)
  • 2020-12-05 00:11

    This page lists all events that work in all browsers to my knowledge. You will not find the "paste" event here, because, as others pointed it out, it doesn't work in all browsers.

    http://www.authenticsociety.com/jquery/list-all-jquery-events.html

    0 讨论(0)
  • 2020-12-05 00:11

    I know this question is pretty old. But for the sake of giving an updated and complete answer to this question.

    The shortcut methods are always named the same as the event names used in any of the on()/bind()/live() methods.

    So if you want to use any shortcut event feature but with on()/bind()/live() you can just take the method name, ommit the brackets and put it in quotes like so: "eventname"/'eventname'. They should behave the same.

    So for example: .dblclick() -> 'dblclick' =>

    $('a').on('dblclick', function() {  
        console.log("I got double clicked");
    });
    

    http://api.jquery.com/category/events/ is a complete list of event methods. (Yes I know I'm not the only one pointing to this site but together with my explanation it actually is a complete list of events for 'on'/'live'/'bind')

    If you have the chance to use on() you should do so since on() does the same and all calls to 'bind' and 'live' actually call the 'on' function. Here is more prove about this: What's the difference between `on` and `live` or `bind`?

    Also some people asked about the touch (mobile) events. I generally recommend to get used to the on() event method because according to the jQuery mobile documentation this is the only way to register touch events on html elements, which is on par with jQuery's future api plans to remove bind()/live() and all the shortcut event methods.

    0 讨论(0)
提交回复
热议问题