e.target javascript
Using the event.target property together with the element.tagName property to find out which element triggered a specified event:
<body onclick="myFunction(event)">
<p>Click on any elements in this document to find out which element triggered the onclick event.</p>
<h1>This is a heading</h1>
<button>This is a button</button>
<p id="demo"></p>
<script>
function myFunction(event) {
var x = event.target;
document.getElementById("demo").innerHTML = "Triggered by a " + x.tagName + " element";
}
</script>const theTarget = someEvent.target;
Also in JavaScript:
- terminal tree command
- not equal to in js
- angular.min.js version
- count word and space in text javascript
- get raspberry pi to run node on startup
- remove text element jquery
- how to get file name in directory node js
- trigger click on checkbox jquery
- adding numbers in an array javascript
- jquery select2 multiple select all
- News Application With Angular and Material Design
- how to print numbers in javascript
- form changes button enable reactive forms
- in select option how to make one default in angular
- javascript function to format phone number
- ajax laravel get values from form
- javascript find unique values in array of objects
- length of an array javascript
- express ssl
- linked list javascript
- how to get a channelid discord.js
- react hide source code
- how to use the map method in javascript
- javascript template literals