Skip to content
Advertisement

How to make pagination (number of the current element)?

I want to make a navigation, that looks like 1/5 then 2/5 then 3/5 and so on.

  • the first digit is the number of the current page
  • the second digit is the total number of pages

At the moment, everything works, except for the number of the current page: it is created, but the old one is not deleted.

Thank you in advance!

JavaScript
JavaScript
JavaScript

Advertisement

Answer

You need to use textContent instead of append, as append will add but will not reset the old value.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement