¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita+ 3
Why can't I change backgroundcolor and return to the normal color with input checkbox using Js, I'm confused guys please help
3 Respuestas
+ 1
if(document.getElementById("range").checked == true) ☑️
if(document.getElementById("range").value=true) ❎
You forgot to implement the else condition's body too.
+ 3
Use the "checked" property instead of "value" to get the current state of the checkbox.
Also remember that = is used for assignments only. Use == or === for comparison.
+ 1
I tried == no result