i made a button that when u click it, the webpage turn to dark theme but when i reclick it, it stays black i want it to return back to the default (white) like a loop
const myBtn = document.getElementById("darktheme");
const body = document.body;
const welcome = document.getElementById("txtt")
myBtn.addEventListener("click", function(){
body.style.backgroundColor = "rgb(17, 17, 17)";
body.style.color = "white";
welcome.style.color = "white";
})
can anyone Help ?
Base on your code :