Code: Select all
Uncaught TypeError: Cannot read properties of undefined (reading 'remove')
at getValue (darkModeSwitch.js:8)
at window.onload (index.html:17)
Uncaught TypeError: Cannot read properties of undefined (reading 'add')
at getValue (darkModeSwitch.js:13)
at HTMLInputElement.onclick (index.html:26)
< /code>
const body = document.body
const anchor = document.getElementsByTagName("a");
const darkModeToggle = document.getElementById('darkModeToggle');
function getValue(){
if (darkModeToggle.checked) {
body.classList.remove("lightmode")
anchor.classList.remove("lightmode")
console.log("checked")
} else{
console.log("not checked")
body.classList.add("lightmode")
anchor.classList.add("lightmode")
}
};< /code>
.lightmode{
background-color: white;
color: black;
}< /code>
[list]
[*][url=kapcsolat/kapcsolat.html?version=691]Kapcsolat[/url]
[*][url=projects/projects.html?version=691]Projektek
[*]Kezdőlap[/url]
[*]
[url=index.html?version=-23424893215]jayden.hu[/url]
[/list]