I am trying to store the initial value of a class and return it to a conditional ternary operator when it does not meet the conditions
I tried something like:
function toggleDarkLight() {
var body = document.getElementById("body");
var currentClass = body.className;
var almacenaclaseincial= [claseinicial=document.getElementById("body")];
body.className = currentClass == "sidebar-fixed dark-mode" ? "sidebar-fixed light-mode" :
currentClass == "sidebar-fixed dark-mode sidebar-slim" ? "sidebar-fixed light-mode sidebar-slim" :
currentClass == "sidebar-fixed dark-mode sidebar-overlay" ? "sidebar-fixed light-mode sidebar-overlay" :
claseinicial;}
The HTML is quite extensive but I just need to modify
<body class="sidebar-fixed dark-mode" id="body"></body>