this.btn.addEventListener("click", clickHandler.bind(this)); - works great
this.btn2.addEventListener("click", clickHandler2.bind(this)); - doesn't work
I used the same code and just appended 2 - btn2 and clickHandler2.
I even created a new button btn2 (with an instance etc...)
As it didn't work I thought there may be a problem with the event listeners so I removed them
I'm afraid the btn2 still doesn't work on frame2.
Copy link to clipboard
Whenever something doesn't work that you think should, always, ALWAYS verify your assumptions.
Does this.btn2 exist?
Does clickHandler2 exist?
Does clickHandler2 actually execute?
And I don't mean verify with your eyeballs. I mean verify with code that explicitly accesses the variable or function or object, and displays an alert or console.log or whatever with the result of that access.
Excellent answer. I'm a teacher too, I like your style and your profile picture, slightly menacing lol.
Everything exists but you made me go over everything with a fine-tooth comb.
The btn2 button was not placed where it was supposed to be.