- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery event.type property with Example
The event.type property in jQuery is used to return which event type was triggered.
Syntax
The syntax is as follows −
event.type
Example
Let us now see an example to implement the jQuery event.type property −
<!DOCTYPE html> <html> <head> <style> .demo { color: blue; background-color: orange; } .test { color: white; background-color: black; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").on("click dblclick mouseover",function(event){ $("div").html(event.type+" event"); }); }); </script> </head> <body> <h2>Heading Two</h2> <p class="demo">Click here and let's see whether it was a click, double click or mouseover</p> <div class="test"/> </body> </html>
Output
This will produce the following output −
Now, keep the cursor on the <p> element text and let’s see which event that would be −
Now, double click on the <p> element text and let’s see what event would be visible −
Advertisements