I was wondering how to save the html language on a website after reloading the page. I created a couple of language buttons, here's one example:
<a onclick="changeLang('pt')" href="#" title="Portugese" data-lang="Portugese">
<div class="flag pt">Portugese</div>
</a>
And a bit of code in my JS file:
const changeLang = (languageCode) => {
document.documentElement.setAttribute("lang", languageCode);
};
How can I make sure the language stays Portugese after clicking the button?
Thank you for your help in advance!