Hello!
I am facing an issue with the afterrender function. Inside the afterrender, I attached a loop that adds event listener to an element. Now, everytime the afterrender is executed, the addeventlistener also gets executed which leads to multiple events in an element. How do i stop this? I have tried to put a flagging but the next time the afterrender is executed, the events are no longer working.