Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the usage/meaning of jQuery event.detail?

Tags:

jquery

I handle the click event on a button and when clicking it the e.detail = 0, when I hit enter inside a textbox and for some reason the button click gets triggered (asp.net) e.detail = 1.

I couldn't find this in the jQuery documentation, it's just written that it is there but it doesn't say what it does.

Event Properties

The following properties are guaranteed to be members of the event object, though some of their values may be undefined, depending on the event:

altKey, attrChange, attrName, bubbles, button, cancelable, charCode, clientX, clientY, ctrlKey, currentTarget, data, detail, eventPhase, fromElement, handler, keyCode, layerX, layerY, metaKey, newValue, offsetX, offsetY, originalTarget, pageX, pageY, prevValue, relatedNode, relatedTarget, screenX, screenY, shiftKey, srcElement, target, toElement, view, wheelDelta, which

like image 762
Omu Avatar asked Nov 25 '25 09:11

Omu


1 Answers

According to MDN, it varies by event type. The event.detail property...

Returns additional numerical information about the event, depending on the type of event. See the Notes section for details.

For mouse events, such as click, dblclick, mousedown, or mouseup, the detail property indicates how many times the mouse has been clicked in the same location for this event.

For a dblclick event the value of detail is always 2.

like image 113
FishBasketGordo Avatar answered Nov 26 '25 23:11

FishBasketGordo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!