我从视频教程中学习 html/css/js。我正在学习如何编写 js 代码,我无法帮助解决问题。我希望你给我解决方案。问题是关于 add.EventListener。当我在 chrome 中运行代码时,它在控制台中显示:“app.js:11 Uncaught TypeError: Cannot read property 'addEventListener' of null”我希望在您的帮助下解决这个问题。谢谢!
const computerScore = 0;
const userScore_span = document.getElementById("user-score");
const computerScore_span = document.getElementById("computer-score");
const scoreBoard_div = document.querySelector(".score-board");
const result_div = document.querySelector(".result");
const p_div = document.getElementById("p");
const r_div = document.getElementById("r");
const s_div = document.getElementById("s");
p_div.addEventListener('click', function() {
console.log("hey you clicked on p");
})`
慕村9548890
相关分类