Monday, October 17, 2022

Events in JavaScript

If parent node contains 'logo' in className => class="logo":

if (e.target.parentNode.classList.contains('logo')) { }

If parent node contains <li></li> TAG:

if (e.target.parentNode.tagName === 'LI') { }

console.log(e.target); // show clicked target

console.log(e); // show event

https://www.section.io/engineering-education/keyboard-events-in-javascript/

https://stackoverflow.com/questions/7723188/what-properties-can-i-use-with-event-target

No comments:

Post a Comment