const favInput = document.getElementById('favcolor'); const saveBtn = document.getElementById('save'); const msg = document.getElementById('msg'); chrome.storage.sync.get(['favcolor']).then(data => { favInput.value = data.favcolor || ''; }); saveBtn.addEventListener('click', () => { const val = favInput.value || ''; chrome.storage.sync.set({ favcolor: val }).then(() => { msg.textContent = 'Saved.'; setTimeout(() => (msg.textContent = ''), 1500); }); });