diff --git a/dark-light-theme-toggle.js b/dark-light-theme-toggle.js new file mode 100644 index 0000000..6a3810a --- /dev/null +++ b/dark-light-theme-toggle.js @@ -0,0 +1,11 @@ +let themeToggle = document.getElementById('themeToggle'); + +themeToggle.addEventListener('change', () => { + let lightThemeEnabled = document.body.classList.toggle('light-theme'); + localStorage.setItem('light-theme-enadled', lightThemeEnabled); +}); + +if (JSON.parse(localStorage.getItem('light-theme-enadled'))) { + document.body.classList.add('light-theme'); + themeToggle.setAttribute('checked', 'checked'); +} diff --git a/index.html b/index.html index ad6a11b..f3b8af7 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,13 @@ +
+Don't divide by Zero.