detail
Summary
Gets additional, developer defined, information about an event.
Property of dom/UIEventdom/UIEvent
Syntax
Note: This property is read-only.
var eventDetails = event.detail;
Return Value
Returns an object of type NumberNumber
Returns additional numerical information about the event, depending on the type of event.
Examples
<!DOCTYPE html>
<html>
<head>
<title>event.detail example</title>
<script type="text/javascript">
function giveDetails(e) {
var text = document.getElementById("t");
text.value = e.detail;
}
function init() {
var b1 = document.getElementById("b");
b1.onclick = giveDetails;
}
</script>
</head>
<body onload="init();">
<form>
<input id="b" type="button" value="details"/>
<input id="t" type="text" value=""/><br/>
<input type="reset"/>
</form>
</body>
</html>
Usage
Use this property to get developer defined information about a developer generated event, if any. When part of a user agent initiated UIEvent, this property is never set.
Notes
You can set the detail property of an event by using the initUIEvent method.
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.
Related specifications
- DOM Level 3 Events
- Working Draft
Attributions
Mozilla Developer Network : [event.detail Article]
Microsoft Developer Network: [detail Property Article]