jQuery event.timeStamp Property

Last Updated:

jQuery event.timeStamp Property

The jQuery event.timeStamp property returns the difference in milliseconds between the time the browser created the event and January 1, 1970.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery event.timeStamp Property</h1> <p>Click on this paragraph</p> <div>Click on this div</div> <p>Time since last clicked : <strong>0</strong> ms</p> <script> $(document).ready(function(){ $("body").click(function(e){ $("strong").text(e.timeStamp); }); }); </script> </body> </html>

Syntax

event.timeStamp

Return Value

Value Explanation
millisec Returns the number of milliseconds since January 1, 1970, when the event is triggered.

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
event.timeStampYesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author