Renaming function stops it from working #1131
Replies: 2 comments
-
From the provided code, there are a few issues and things to address:
Here's a basic correction: <!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
</head>
<body>
<button id="left" onclick="buttonClicked()">Left Button</button>
<button id="right" onclick="buttonClick()">Right Button</button>
<div id="mainDiv"></div>
<script>
let wall = 0;
function buttonClicked() {
wall += 1;
document.getElementById("mainDiv").textContent = "Button Clicked times: " + wall;
}
function buttonClick() {
wall += 1;
document.getElementById("mainDiv").textContent = "Button Clicked times: " + wall;
}
</script>
</body>
</html> In this corrected code, both the left and right buttons should increment the |
Beta Was this translation helpful? Give feedback.
-
Please use the discord for programming questions like these Closing as this is not a product specific issue |
Beta Was this translation helpful? Give feedback.
-
`
<title>Title</title> <script src="script.js"></script>Hello World
⇐ ⇒
`
Why does the left button work but no matter what method I try the right one won't do the same I literally just renamed it?
Beta Was this translation helpful? Give feedback.
All reactions