Есть localStorage
Делаю так:
if (checked == true)
{
var comparedText = document.getElementById('button_on_checkbox').innerHTML = 'В сравнении';
localStorage.setItem('comparedText', comparedText);
if(localStorage.getItem('compareText') == 'В сравнении')
{ document.getElementById('button_on_checkbox').innerHTML = 'В сравнении';
}
document.getElementById(`compare-active`).classList.add(`compare-active`);
}
В консоли у localStorage есть compareText, но при обновлении страницы надпись 'В сравнении' не сохраняется
