Skip to content

Commit

Permalink
Disabled the Previous and Next Button as soon as they are clicked, to…
Browse files Browse the repository at this point in the history
… prevent the user multiple clicking the button.
  • Loading branch information
TyroneAEM committed Jun 5, 2024
1 parent 8ac3b46 commit ca26d4f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion blocks/gmo-program-list/gmo-program-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ function buildListFooter(rows, rowsPerPage) {
footerPrev.classList.add('footer-pagination-button', 'prev');
footerPrev.textContent = 'Prev';
footerPrev.addEventListener('click', debounce((event) => {
// Disable the button
footerPrev.classList.remove('active');
footerPrev.classList.add('disabled');
prevPage(event.target);
}, 500));

Expand All @@ -338,6 +341,9 @@ function buildListFooter(rows, rowsPerPage) {
buildCurrentPageDivElement(currentPage, footerPageBtnsWrapper);

footerNext.addEventListener('click', debounce((event) => {
// Disable the button
footerNext.classList.remove('active');
footerNext.classList.add('disabled');
nextPage(event.target);
}, 500));

Expand Down Expand Up @@ -505,4 +511,4 @@ function sortColumn(dir, property) {
function dateFormat(dateString) {
const formattedDate = dateString ? dateString.split('T')[0] : 'Not Available';
return formattedDate;
}
}

0 comments on commit ca26d4f

Please sign in to comment.