I need a function that changes background color on click and saves it. How can do that using localStorage?
My code:
const colors = document.querySelectorAll('.color-btn');
colors[0].addEventListener('click', () => {
document.body.style.backgroundColor = 'red'
})
Now how can I make that when I reload the page the function doesn't reset (no jquery).