0

I have a button element and inside it contains an icon. Something like:

<button class="btn d-inline like"><i class="fas fa-thumbs-up fa-lg"></i></button>

when I click on le "thum" rendered, my goal is to get the event click as if I make click all the time on the button. In my javascript, I get the element clicked par example with some code like:

$('.like').on('click', function (event) {
event.preventDefault();
console.log(event.target)

and depending on where I click I get the icon or the button in the console log. How can I click on that and get every time only the button?

Regarding the duplicate tag: How am I supposed to know the question has another answer if I didn't know currentTarget existed.

Abdel Hidalgo
  • 109
  • 1
  • 8

0 Answers0