if I have a class method that has a ‘click’ addEventListener that calls another method with a click event how do I make it so they are two distinct/separate clicks? For example:
pickUp() {
upcard.addEventListener('click', () => {
this.playerDiscard()
...
above the user clicks on the card they’re adding to their hand and the other method looks like this:
playerDiscard(){
playerCardSlot1.addEventListener('click', this.clickHandler())
playerCardSlot2.addEventListener('click', this.clickHandler())
}
I 'm assuming the first click event is triggering the playerDiscard()
click event (playerCardslot1) however my problem is that the user should be able to click again to select whatever playerCardSlot they want to discard. Should I be adding a conditional statement above the playerDiscard event listeners or just remove the pickUp event listener? I have read a lot of documentation online, but am still not sure what to do. I would greatly appreciate some advice here. Thank you again.