I have a side nav with sections that are accordions. I want to save the state of the accordion whether it be display = none or block.
function toggle(tgl){
btn = document.getElementById(tgl.id+'1');
expiration = new Date();
expiration.setFullYear(expiration.getFullYear()+1);
btn.classList.toggle("active");
if (tgl.style.display == 'none' || tgl.style.display == '' ) {
tgl.style.display = 'block';
var show = 'tgl.style.display = "block"';
document.cookie = show;
console.log(bong + ' hyar');
} else {
tgl.style.display = 'none';
var hide = 'tgl.style.display = "none"'
document.cookie = hide;'expires = '+expiration.toUTCString();
console.log(document.cookie);
}
}