 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML currentTarget Event Property
The currentTarget event property in HTML is used to get the element whose event listeners triggered the event.
Following is the syntax −
event.currentTarget
Let us now see an example to implement the currentTarget event property −
Example
<!DOCTYPE html> <html> <body> <h2>Get the element</h2> <p onclick="myFunction(event)">Click on this line to generate an alert box displaying the element whose eventlistener triggered the event.</p> <script>    function myFunction(event) {       alert("Element = "+event.currentTarget.nodeName);    } </script> </body> </html>  Output

Now double click on the line as shown in the above screenshot to generate an alert box that would display the element whose event listeners triggered the event −

Advertisements
 