I am writing pagination for my project and have a problem with click event stacking on each other. Here’s my project:
If you go to “recipes” tab and choose a category (don’t use input, not implemented yet) you will get recipes through API and it will create a pagination on the bottom. Now when i click on the page i want to :
When changing the page it should show 10 different recipes according to the page we are at but it seems that the click event keeps stacking with every click, e.g =>
1st click = 10 results,
2nd click = 20 result,
3rd click = 40 results and so on…
I have tried:
- Using a named event handler in the click event but then i can’t use event.target for changing the page number
- Using “once:true” as an extra parameter in the click event, it did nothing.
Code for getting the recipes starts at line 114 in public/recipes.js.
Code for creating buttons, pages and stuff starts at line 153
Any help would be greatly appreciated !