+ 1

Problem whit Javascript

Hi I need to change the color of "isFalse" if her value is "true" but is hard for me😅 const isFalse = false document.getElementById("isFalse"); if("isFalse"=="true"){ } Can you help me please??? (Im a beginner)

26th Nov 2024, 7:22 PM
Hi"-"
Hi"-" - avatar
2 odpowiedzi
+ 6
First remove the “” in the if statement you already declared the isFalse variable so no need to turn it into a string and true also shouldn’t be a string (although it’s possible that it might work anyway as you are using == instead of ===. Still, better to get rid of the “” and use ===). Also, this doesn’t seem right, it is unlikely that you are trying to get hold of an element with id of isFalse. You are probably trying to set isFalse to a boolean and then set an element based on this. If you link your entire code someone will guide you further.
26th Nov 2024, 7:33 PM
Zvi
Zvi - avatar
+ 1
Please read the following and update your question, someone can then help you more easily: https://sololearn.com/compiler-playground/Wek0V1MyIR2r/?ref=app https://sololearn.com/compiler-playground/W3uiji9X28C1/?ref=app
27th Nov 2024, 7:47 AM
Ausgrindtube
Ausgrindtube - avatar