I have several .js files each containing different functions and several HTML files showing different parts of the website. I declared a variable in main.js called var lang = "ENG". However, this is the default language in case the user doesn't select a language to change the content of the website. If I were to click a button in index.html:
<button id="french" onclick="changeLang('French')">French</button>
It should change the language of the var lang to "FRE" permanently for the rest of the current browsing period. I have tried using innerHTML, a click listener, a function returning the new value (i.e. var lang = setLanguage(inp), but nothing seems to work. Would anyone please give a suggestion on this? I am working off a large existing code database so I would like something that works in this context (currently not better ways of implementing a "language" facility in the website), although that would certainly be an improvement I would work on long-term. Thanks!