Home  >  Article  >  Web Front-end  >  jquery uses namespace to remove bound events_jquery

jquery uses namespace to remove bound events_jquery

WBOY
WBOYOriginal
2016-05-16 16:10:031306browse

The example in this article describes how jquery uses namespace to remove bound events. Share it with everyone for your reference. The specific analysis is as follows:

Recently researching jquery, I found a simple method to remove bound events, namespace.

The example is simple.

Here I have bound three events, namely click, mouseover and dblclick events
Among them, I added the namespace to the click and mouseover events, but dblclick did not add the namespace.
Use a button to remove the bound event.
This avoids repeated use of bind and unbind methods, making your code look more concise and clear.

Copy code The code is as follows:

The layer that has been bound to
click, mouseover, dblclick events

The operation effect is as follows:

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

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