100-project-100-days-website/100_projects/53-custom-checkbox-toggle-dark-light-mode/app.js

10 lines
244 B
JavaScript
Raw Normal View History

2023-04-15 00:39:31 +03:00
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');
}
}