Jquery uses the data method to obtain events on an element.

Source: Internet
Author: User

Jquery events bound to elements can be retrieved using the data method.

Use $ (element). data ("events") to obtain

// For example, bind two click events to a button $ ("button "). click (function () {alert ("1")}); $ ("button "). click (function () {alert ("2 ")}); // click this button at this time, and the alert boxes of 2 and 1 will pop up respectively. // retrieve all the click events of the button, which is an array.
$("button").data('events').click

The array of two click events is displayed.

To get the array, you can adjust the order and then set it back.

$("button").data('events').click = newEventArray;

The following is the test page for this method:

<Span style = "font-size: 18px;"> <% @ page contentType = "text/html; charset = UTF-8" language = "java" %> <! Doctype html> 

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.