what's the usage/meaning of jQuery event.detail?
I handle the click event on a button and when clicking it the e.detail = 0
, w开发者_Go百科hen 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
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.
Returns additional numerical information about the event, depending on the type of event.
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.
you can see it here: https://developer.mozilla.org/en/DOM/event.detail#Notes
IE in Windows 8 or Windows Server 2012 doesn't support this property(event.detail) properly.So this property should be tested on different machines before use.
精彩评论