Dev Dastan: post #53 — TG.ME

📱 JavaScript Quiz

⁉️ What is the event.target when clicking the button?

<div onclick="console.log('first div')">
<div onclick="console.log('second div')">
<button onclick="console.log('button')">
Click!
</button>
</div>
</div>


🔤 Outer div
🔤 Inner div
🔤 button
🔤 An array of all nested elements.

✔️ Answer: 🔠
The deepest nested element that caused the event is the target of the event. You can stop bubbling by event.stopPropagation



#JavaScript #Quiz


🖥 Follow @devDastan for more content.
🤯5👍4❤3
August 14, 2024 521