jQuery event.timeStamp Property

Introduction

Get the time for click event as the number of milliseconds since Jan 1, 1970.

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>//from   w  ww . j  a  v  a2 s .c  o  m
<script>
$(document).ready(function(){
  $("button").click(function(event){
    $("span").text(event.timeStamp);
  });
});
</script>
</head>
<body>

<p>The click event occurred 
<span style="color:red">unknown</span> 
milliseconds after January 1, 1970.</p>

<button>Click me</button>

</body>
</html>

The event.timeStamp property returns when the event is triggered as the number of milliseconds since January 1, 1970.

event.timeStamp
Parameter OptionalDescription
event Required. The event parameter comes from the event binding function



PreviousNext

Related