Where in the code to add this?

Hi!
Can't understand where in this code to add this.
Meaning: when you press one of the buttons in the console should contain the string.
Understand how to do it inline in the HTML (onclick="func(this)"), and separately with HTML to realize the brain is not enough.
June 14th 19 at 18:00
2 answers
June 14th 19 at 18:02
Solution
  1. Will not have to add, inside the event handler this and it will point to the element.
  2. Cannot have multiple elements with the same id, your code is wrong and only handles one button.

Examples of correct implementation:
https://codepen.io/alexey-m-ukolov/pen/aLYRNK?edit...
https://codepen.io/alexey-m-ukolov/pen/yzKRVo?edit...
June 14th 19 at 18:04
Id class replace and go through the elements forEach-eat
Too shy to ask...Why pass cycle on them? - noe commented on June 14th 19 at 18:07
He has 5 buttons.how does it even walk?
You offer to each individual listener to supply? - Ezequiel_Koch commented on June 14th 19 at 18:10
You offer to each individual listener to supply?
Side Note: When you use forEach is exactly what will happen. - aniya commented on June 14th 19 at 18:13
,
Sorry,that came out wrong.I mean
Btn1.addEventListener...
Btn2.addEventListener.. - Ezequiel_Koch commented on June 14th 19 at 18:16

Find more questions by tags JavaScript