I have a drop-down selector that lets you chose the theme of the site with options "white" and "black".
<select name="Invert" onchange="changeColor(this)">
<option value="white">White</option>
<option value="black">Black</option>
</select>
Then i have the folowing js function changeColor()
function changeColor(x) {
var body = document.getElementById('body');
if (x.value == 'black') {
body.style.backgroundColor = x.value;
body.style.color = 'white';
} else if (x.value == 'white') {
body.style.backgroundColor = x.value;
body.style.color = 'black';
}
}
I have the same selector and js function set for other pages in separate js files for each page.
When i select a theme option and then refresh or go to another page the theme color goes back to the default white.
The question is, how do i keep the changed theme for other pages, also after refreshing the website?