3 min read

What is jQuery event methods and properties?

These methods and properties are used to register behaviors to take effect when the user interacts.
What is jQuery event methods and properties?

Event refers to the actions performed by the site visitor during their interactivity with the website (or webpage).There can be various types of events like:

  1. User clicks on the button.
  2. User moves mouse pointer over an image.
  3. User pressed any key from keyboard, etc.

There are lot of events in jQuery such as bind(), blur(), focus(),  event.type, event.timeStamp property ,change(), click(), dblclick(), hover(), keypress() etc.

jQuery | event.timeStamp Property with Example

It is an inbuilt property in jQuery which is used to measure difference in milliseconds between the time of event created by the browser and January 1, 1970.

syntax: event.timeStamp

It does not accept any parameter because it is a property not a function.
This returns the number of milliseconds since January 1, 1970, when the event is triggered.

example:

<html>
   
<head>
    </script>
    <script>
        <!-- jQuery code to show the working of event.timeStamp property -->
        $(document).ready(function() {
            $("p").click(function(event) {
                $("span").text(event.timeStamp);
            });
        });
    </script>
    <style>
        p {
            width: 80%;
            padding: 20px;
            display: block;
            border: 2px solid green;
        }
    </style>
</head>
   
<body>
    <!-- click on this paragraph -->
    <p>The click event occurred <span style="color:green">unknown</span>
            milliseconds after January 1, 1970.</p>
</body>
   
</html>

Output:
Before clicking on the paragraph-

After clicking on the paragraph-

Here's  more to read...

GeeksforGeeks | A computer science portal for geeks
A computer science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
src:https://www.geeksforgeeks.org/

#jQuery #Events #Methods #Property #programming #Probyto #Probyto AI

Subscribe and follow us for latest news in Data Science and Machine learning and stay updated!
Facebook: https://facebook.com/probyto
Twitter: https://twitter.com/probyto
LinkedIn: https://linkedin.com/company/probyto
Instagram: https://instagram.com/probyto