This article mainly shares with you the jquery click-and double-click event conflict solution. For more information, see add double-click events to the Tree node of bootstrap-treeview. The native method of this plug-in does not include the double-click event function. By default, the node of this plug-in is bound with a click event, which causes a conflict between the Click Event and the double-click event.
Write test code
Conflicting code:
Problem result display:
Each double-click event triggers two click events.
Conflict resolution code:
Problem solving result display:
Perfectly solves the conflict between click events and double-click events
Here we mainly use the functions in two HTMLDOMWindow objects, settimeout () and clearTimeout ()
The interval between the two click events is set to 300 milliseconds, depending on the actual situation.
The source code is as follows:
Event monitoring