100-project-100-days-website/100_projects/53-custom-checkbox-toggle-dark-light-mode/app.js
2023-04-15 00:39:31 +03:00
Ask

10 lines
244 B
JavaScript

{08292d3041c193e448b9a09044a63dfb73105d83 true 244 app.js 0xc002bbbea0}

let body = document.querySelector('body');
let dark = document.querySelector('#dark');
dark.onclick = function (){
if(dark.checked == true){
body.classList.add('darkMode');
} else {
body.classList.remove('darkMode');
}
}