+ 1
Help me please🙏. I don't know what's wrong in my code. (I need both buttons to output the answer, not just one).
3 Réponses
+ 6
You have defined two window.onload event handler functions. That's why it doesn't work.
Combine content of the two functions' - move line 13 ~ 14 after line 6 (JS Tab)
+ 3
what Ipang said👍:
also, use let or const.
function pon() {
alert("you are right bro");
}
function da() {
alert("you are wrong try again");
}
window.onload = function() {
const btn = document.getElementById("but");
const bbb = document.getElementById("ok");
btn.onclick = pon;
bbb.onclick = da;
}
+ 2
Thank you very much!👍