SpongeBOB
Well-Known Coder
Hi everyone,
I would like to run a JavaScript if a cookie exist ->
[CODE lang="javascript" highlight="5,6" title="within my html page"]<script>
const setTheme = theme => document.documentElement.className = theme;
let currentTH = getCookie("theme");
if (currentTH != "") {
setTheme(currentTH);alert(currentTH);
}
</script>[/CODE]
But is seem that line 5 & 6 are not executing :/ , any ideas ?
I would like to run a JavaScript if a cookie exist ->
[CODE lang="javascript" highlight="5,6" title="within my html page"]<script>
const setTheme = theme => document.documentElement.className = theme;
let currentTH = getCookie("theme");
if (currentTH != "") {
setTheme(currentTH);alert(currentTH);
}
</script>[/CODE]
But is seem that line 5 & 6 are not executing :/ , any ideas ?