+ 1
I added an onclick event to this green box but it did not work
Onclick not working for my code https://code.sololearn.com/W6LGd6lSvZmu/?ref=app PanicS
7 Antworten
+ 3
write "getElementById" in camelCase
+ 2
function mtsc() {
var x = document.getElementById("bes");
x.style.display="none";
}
+ 2
The result of getElementByTagName is an array so you should use a loop such as for or foreach.
In your case:
for(var i of d){
i.onclick = function (){
a.style.display = "block";
}
}
0
zexu knub it says type error undefined
0
D Doyen use CAPS for ById