javascript event get div text 1

javascript event get div text

console.log(event.target.innerText)

Here is what the above code is Doing:
1. We’re listening for a click event on the document.
2. When the click event happens, we’re going to run a function.
3. Inside the function, we’re going to log the text of the element that was clicked.

Similar Posts