After some research, I found that jQuery caches events. In fact, it is also to prevent memory overflow and speed up page unloading. It also includes multiple function triggers, convenient management, and many other benefits. You can refer to this article for details.
jQuery will unload all bound events and release memory during window.unload.
OK, let’s get down to business. To determine whether an event has been bound to an element, use the following statement
jQuery .data(elem,"events")[type] //Old versions can also be used
$(elem).data("events")[type] //Can only be used after 1.2.3
Return value:
An Object, which can be traversed using for in. or undefined.
Parameters:
elem is a DOM object, type is the event type.
Example:
Determine whether the click event is bound to the element with id foo
if( $("#foo").data("events")["click"] ){
//your code
}
Statement: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