• <thead id="q1n0p"><tbody id="q1n0p"><strong id="q1n0p"></strong></tbody></thead>
    <blockquote id="q1n0p"><span id="q1n0p"><label id="q1n0p"></label></span></blockquote>
  • <\/code> element:<\/p>
    const toggleButton = document.getElementById('theme-toggle');\nconst currentTheme = localStorage.getItem('theme') || 'light';\n\n\/\/ Set saved theme on load\ndocument.documentElement.setAttribute('data-theme', currentTheme);\n\n\/\/ Update button text based on current theme\ntoggleButton.textContent = currentTheme === 'dark' ? 'Switch to Light' : 'Switch to Dark';\n\ntoggleButton.addEventListener('click', () => {\n  let currentTheme = document.documentElement.getAttribute('data-theme');\n  let newTheme = currentTheme === 'dark' ? 'light' : 'dark';\n\n  document.documentElement.setAttribute('data-theme', newTheme);\n\n  \/\/ Save preference\n  localStorage.setItem('theme', newTheme);\n\n  \/\/ Update button text\n  toggleButton.textContent = newTheme === 'dark' ? 'Switch to Light' : 'Switch to Dark';\n});<\/pre>

    This script:<\/p>