Home > Web Front-end > JS Tutorial > body text

jQuery method to determine whether a specified event is bound to an element_jquery

WBOY
Release: 2016-05-16 16:08:55
Original
1055 people have browsed it

The example in this article describes how jQuery determines whether a specified event is bound to an element. Share it with everyone for your reference. The details are as follows:

For example, the following code can determine whether the element with id=testdiv is bound to a click event. This determination is only valid for jQuery-bound events, and ordinary JS event binding is invalid.

//jQuery event封装支持判断元素上是否绑定了事件,此方法只适用于jQuery绑定的事件
var $events = $("#testdiv").data("events");
if( $events && $events["click"] ){
  //your code here
}
Copy after login

I hope this article will be helpful to everyone’s jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template