We'd love your Feedback!
+Your feedback helps us improve our product.
+ + + + + + + + + + + +diff --git a/darkMode.js b/darkMode.js index f3597c3..e32797c 100644 --- a/darkMode.js +++ b/darkMode.js @@ -1,22 +1,33 @@ -const checkbox = document.getElementById('checkbox') -const modeLabel = document.getElementById('mode-label') +document.addEventListener('DOMContentLoaded', () => { + const checkbox = document.getElementById('checkbox'); + const modeLabel = document.getElementById('mode-label'); -// Check if dark mode is already enabled -if (localStorage.getItem('theme') === 'dark') { - document.documentElement.setAttribute('data-theme', 'dark') - checkbox.checked = true - modeLabel.textContent = 'Dark Mode' -} + // Check if checkbox and modeLabel exist + if (!checkbox || !modeLabel) { + console.error('Checkbox or Mode Label element not found!'); + return; + } -// Add event listener for toggle switch -checkbox.addEventListener('change', () => { - if (checkbox.checked) { - document.documentElement.setAttribute('data-theme', 'dark') - localStorage.setItem('theme', 'dark') - modeLabel.textContent = 'Dark Mode' + // Check if dark mode is already enabled + if (localStorage.getItem('theme') === 'dark') { + document.documentElement.setAttribute('data-theme', 'dark'); + checkbox.checked = true; + modeLabel.textContent = 'Dark Mode'; } else { - document.documentElement.setAttribute('data-theme', 'light') - localStorage.setItem('theme', 'light') - modeLabel.textContent = 'Light Mode' + document.documentElement.setAttribute('data-theme', 'light'); + modeLabel.textContent = 'Light Mode'; } -}) + + // Add event listener for the toggle switch + checkbox.addEventListener('change', () => { + if (checkbox.checked) { + document.documentElement.setAttribute('data-theme', 'dark'); + localStorage.setItem('theme', 'dark'); + modeLabel.textContent = 'Dark Mode'; + } else { + document.documentElement.setAttribute('data-theme', 'light'); + localStorage.setItem('theme', 'light'); + modeLabel.textContent = 'Light Mode'; + } + }); +}); diff --git a/feedback.html b/feedback.html index 2e0f6f9..7e8722c 100644 --- a/feedback.html +++ b/feedback.html @@ -3,276 +3,184 @@
-Your feedback helps us improve our product.
+ + + + + + + + + + + +