im sorry if my Question duplicated but i need help im trying to save the selected color to localstorage and keep the last selected color after reload the page. i mean to get last saved color inside localstorage and kep the box with last selected color after reload the page any idea?
const box = document.querySelector(".box");
const colorInput = document.querySelector("input");
const currentColorSpan = document.querySelector("#currentColorSpan");
colorInput.addEventListener("input", () => {
box.style.backgroundColor = colorInput.value;
currentColorSpan.textContent = colorInput.value;
});
.box {
width: 600px;
height: 360px;
border: solid 1px grey;
}
<div class="box">color slected not saved yet inside localstorag</div>
<label>click picker to choose color</label>
<input type="color" value="#ffffff"/>
<p>current color: <span id="currentColorSpan"></span></p>