Skip to content

Commit

Permalink
Add loading text on button when clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
trymebytes committed Dec 12, 2024
1 parent 3540c13 commit 63c2fe7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/js/translation-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
'click',
'.load-more-events-btn',
function ( e ) {
$( this ).text('Loading...').prop('disabled', true);
let eventType = $( this ).data('event-type');
let nextPage = $( this ).data('event-next-page');
const url = `/events/?${encodeURIComponent(eventType)}=${encodeURIComponent(nextPage)}&format=html`;
Expand All @@ -123,6 +124,7 @@
$(this).data('event-next-page', response.data.nextPage);
}
$(this).parent().prev('.wp-block-wporg-event-list').find('ul').append($listItems);
$(this).text('Load more').prop('disabled', false);
})
.catch(error => {
console.error('Error fetching next page:', error);
Expand Down

0 comments on commit 63c2fe7

Please sign in to comment.