diff --git a/src/js/helpers/update-pagination-links.js b/src/js/helpers/update-pagination-links.js index 1f498e0..8c8b49b 100644 --- a/src/js/helpers/update-pagination-links.js +++ b/src/js/helpers/update-pagination-links.js @@ -53,6 +53,10 @@ const updateQuestionNumber = (currentQuestionIndex) => { } }; +const updatePageTitle = (currentQuestionIndex) => { + document.title = document.title.replace(/\d+/, currentQuestionIndex + 1); +}; + export const updatePaginationLinks = () => { const questionsRaw = sessionStorage.getItem('questions'); const currentQuestionIndexRaw = sessionStorage.getItem( @@ -66,6 +70,7 @@ export const updatePaginationLinks = () => { updatePreviousLink(questions, currentQuestionIndex); updateNextLink(questions, currentQuestionIndex); updateQuestionNumber(currentQuestionIndex); + updatePageTitle(currentQuestionIndex); const previousLink = document.querySelector('[data-prev-link]'); previousLink?.addEventListener('click', (event) => {