0

I would like to understand if I have found a bug or I am missing something, looking at the code below selecting the tag <a> the click event brings me back its content as a target instead of tag <a>

document.querySelector('a[data-photo]').addEventListener('click', (e) => {
  console.log('Wrong target');
  console.log(e.target);
});
<a href="#" data-photo><i>fake</i></a>
Simone Rossaini
  • 8,115
  • 1
  • 13
  • 34

0 Answers0