$(() => { // Checks if user chose to have dark mode enabled or disabled throughout the website and enables it if (sessionStorage.getItem("darkmode") == 1) { $("#logo").attr("src", "img/logolight.png"); $('body').addClass('darkMode'); $('#lightSwitch').prop('checked', true); } else { $("#logo").attr("src", "img/logo.png"); $('body').removeClass('darkMode'); $('#lightSwitch').prop('checked', false); } //Listens to click on the darkmode button $('#lightSwitch').click(() => { if ($('#lightSwitch').is(':checked') == true) { $("#logo").attr("src", "img/logolight.png"); $('body').addClass('darkMode'); sessionStorage.setItem("darkmode", 1); } else { $("#logo").attr("src", "img/logo.png"); $('body').removeClass('darkMode'); sessionStorage.setItem("darkmode", 0); } }); }); // jQuery