jquery--getting a binding event on a DOM element

Source: Internet
Author: User

Before the jQuery1.8.0 version, we wanted to get an event handler for a DOM binding to do this:

    $.data (domobj, ' events '); // or $ (' selector '). Data (' Events ')

jquery1.8. Beginning with version 0, jquery suddenly does not support this use, but instead to a function called ' _data ', that is, 1.8.0 and later versions you can use:

$._data (domobj, ' events ');//Note that this does not work like $ (' selector '). _data (' Events ').         /*For example, you can write*/$._data ($ (' #box '). Get (0), ' events ')//Here are all the events bound to get the DOM element with ID box$._data ($ (' #box '). Get (0), ' events ') [' click ']//here is the Click event bound to get the DOM element with ID box    /*or written*/$._data ($ (' #box '). Get (0). Events/*or it can be written*/$.cache[$ (' #box '). Get (0) [$.expando]].events

Compatible with each jquery version, so you can get:

    var eventsdata = $.data (domobj, ' events ') | | $._data (domobj, ' events '); // This change is also reflected in the source code of Easyui 1.3.1. 

jquery--getting a binding event on a DOM element

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.