jQuery event.timeStamp Property
jQuery event.timeStamp property returns the number of milliseconds since January 1, 1970. The event.timeStamp property can be useful for profiling event performance by getting the difference between two event points.
Syntax
event.timeStamp
Parameter | Type | Description |
---|---|---|
event | Event | Required. The event parameter comes from event bind method |
Example
This example returns number of milliseconds since Jan 1, 1970.
<!DOCTYPE html>
<html>
<head>
<title>jQuery event.timeStamp property</title>
<script src="jquery-latest.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(e){
$("span").text(e.timeStamp);
});
});
</script>
</head>
<body>
<p>When you click below button, here return <u><span>_________________</span></u> milliseconds since January 1, 1970.</p>
<button>Get current milliSeconds</button>
</body>
</html>