The dblclick event fires when a user quickly double-clicks an element. Since the browser usually also fires two click events, a short time delay is often used to distinguish actions: if a dblclick occurs during this time, we cancel the "single‑click" action.
The interactive example below demonstrates the use of the dblclick
event and the difference between a single click (click) and a double click (dblclick). Since
the browser usually fires two click events on a double click, the example uses a 250 ms time delay to
distinguish actions: if a dblclick event occurs during this time, the "single-click" action is canceled. The
event object (event) contains the detail property that shows the click sequence, as well as
the clientX and clientY coordinates. The element also supports keyboard accessibility
(Enter/Space), where a "single-click" action is triggered. The log displays all events in real-time.
click events. Below, a short delay is
used to cancel the "single‑click" if a dblclick occurs.
Thank you for visiting! Adding privacy policy.
© 2024 All rights reserved.
Vam je koda pomagala? Če želite podpreti moj trud pri pripravi vodičev in vzdrževanju strani, mi lahko namenite donacijo za kavo.