JQuery checks whether a specified event is bound to an element.
This article mainly introduces jQuery's method of determining whether a specified event is bound to the element. It involves the judgment skills of jQuery's event binding and has some reference value. If you need it, you can refer to it.
This example describes how jQuery checks whether a specified event is bound to an element. Share it with you for your reference. The details are as follows:
For example, the following code can determine whether the element id = testdiv is bound with a click event. This judgment is only valid for events bound to jQuery, and the event binding of common JS is invalid.
?
| 1 2 3 4 5 |
// JQuery event encapsulation supports determining whether events are bound to an element. This method is only applicable to events bound to jQuery. Var $ events = $ ("# testdiv"). data ("events "); If ($ events & $ events ["click"]) { // Your code here } |
I hope this article will help you with jQuery programming.