I have the following code, but I change the background color of the body, I think it must be something of the scope, because it does not give me any error.
I thought about putting body onLoad='setThemes();'
, but it says:
setThemes is not defined at onload
I clarify that the .js
is separated from the html, as for the other functions as settings.darkTheme = true;
, if you do it correctly.
<select id="themes" class="form-control">
<option value="agar" selected>Agar Theme</option>
<option value="slow">SlowMotion Theme</option>
<option value="psyco">Psyco Theme</option>
<option value="ogar">Ogar Theme</option>
</select>
// Themes functions
$(document).ready(function() {
function setThemes() {
gg = document.getElementById('themes');
g2 = gg.options[gg.selectedIndex].value;
if (g2 == 'agar') {
settings.darkTheme = false;
} else if (g2 == 'psyco') {
settings.darkTheme = true;
$(function() {
$("body").css('background-color', 'blue !important');
});
} else if (g2 == 'slow') {
} else if (g2 == 'ogar') {
}
}
$("#themes").on("change", setThemes);
});