Skip to content

Commit

Permalink
fix: display current age and year when switching languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Fran Martín committed Aug 28, 2023
1 parent a8376f1 commit 01c59ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const loadJSON = async () => {

var check = document.querySelector(".check");

async function language() {
async function switch_language() {
var isSwitched = check.checked;
const json = await loadJSON()

Expand All @@ -68,7 +68,11 @@ async function language() {
document.getElementById(navbar_ids[id]).innerHTML = json['es'][navbar_ids[id]]
}
}
// Update the displayed age and years
document.getElementById('current-age').textContent = currentAge();
document.getElementById('current-year').textContent = currentYear();

}
check.addEventListener("click", language);
check.addEventListener("click", switch_language);


0 comments on commit 01c59ea

Please sign in to comment.