Description: This attribute returns the number of milliseconds since January 1, 1970, when the event is triggered.
event.timeStamp
version added: 1.2.6
Example
Display the time since the click handler last executed.Full source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
div { height: 100px; width: 300px; margin: 10px;
background-color: #ffd; overflow: auto; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var last, diff;
$('div').click(function(event) {
if ( last ) {
diff = event.timeStamp - last
$('div').append('time since last event: ' + diff + '<br/>');
} else {
$('div').append('Click again.<br/>');
}
last = event.timeStamp;
});
});
</script>
</head>
<body>
<div></div>
</body>
</html>
Was this information helpful?

