I have a list of buttons and each time one has been clicked I want to check if the one that has been clicked has a certain class name. I have looped over the button and then said if the button contains a class but this doesn’t work.
I have a list of buttons and each time one has been clicked I want to check if the one that has been clicked has a certain class name. I have looped over the button and then said if the button contains a class but this doesn’t work.
2
Answers
You need to add an event listener to the buttons to listen for the "click" event.
The problem was that you wrote helpBtn[i] instead of helpBtn[h]:
and i doesn’t exist.