- 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.currentTarget Property
The event.currentTarget property in jQuery is the current DOM element within the event bubbling phase.
Syntax
The syntax is as follows −
event.currentTarget
Example
Let us now see an example to implement the jQuery event.currentTarget property −
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("h1, p").click(function(event){ alert(event.currentTarget === this); }); }); </script> </head> <body> <h1>World</h1> <p>Countries list...</p> <p>Click on any of the above element and witness a magic.</p> </body> </html>
Output
This will produce the following output −
Click on any of the element above and an alert box generates −
Advertisements