0
Display
So whenever you click the first Door i want it so my second qesution appears under the first question. I used display block and none in javascript but it doesnt seem to be working https://code.sololearn.com/WfzACEC8T03y/?ref=app
3 Antworten
+ 3
Your Mom
let blue = document.getElementById("blue").style.display = "none";
function tigerf() {
if(blue.display === "none") {
blue.display === "block";
}
else {
blue.display === "none";
}
}
In the above function
//blue.display is wrong because of
//blue = document.getElementById("blue").style.display = "none";
You should do:
let blue = document.getElementById('blue');
blue.style.display = 'none';
Now
if (blue.style.display === 'none)
blue.style.display = 'block';
+ 3
Your Mom
Where is your other functions called in html?
+ 3
Your Mom
This is also wrong inside 'if' condition
blue.display === "block";
Here === is used to compare not assign value.
There should be single equal (=) for assign value.