Skip to content

Instantly share code, notes, and snippets.

@ilyasozkurt
Created February 23, 2023 11:59
Show Gist options
  • Save ilyasozkurt/24989887a3962997cfc8b137983a1e43 to your computer and use it in GitHub Desktop.
Save ilyasozkurt/24989887a3962997cfc8b137983a1e43 to your computer and use it in GitHub Desktop.
const prevButton = document.getElementById("prev");
const nextButton = document.getElementById("next");
prevButton.addEventListener("click", () => {
if (currentPage > 0) {
currentPage -= 1;
displayRows();
}
});
nextButton.addEventListener("click", () => {
const lastPage = Math.ceil(tbody.querySelectorAll("tr").length / rowsPerPage) - 1;
if (currentPage < lastPage) {
currentPage += 1;
displayRows();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment