Not working this code. | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
30th Sep 2023, 8:32 AM
Satveek Prakash
Satveek Prakash - avatar
13 Respostas
+ 2
Ok thanks
30th Sep 2023, 8:42 AM
Satveek Prakash
Satveek Prakash - avatar
0
Line 7 Javascript is Something wrong i try to find it
30th Sep 2023, 8:33 AM
D1M3
D1M3 - avatar
0
Ok
30th Sep 2023, 8:34 AM
Satveek Prakash
Satveek Prakash - avatar
0
<!DOCTYPE html> <html> <head> <title>Count Example</title> </head> <body> <button id="decreaseBtn">Decrease</button> <button id="restBtn">Reset</button> <button id="increaseBtn">Increase</button> <p>Count: <span id="countLabel">0</span></p> <script> let count = 0; document.getElementById("restBtn").onclick = function () { count = 0; document.getElementById("countLabel").innerHTML = count; } document.getElementById("increaseBtn").onclick = function () { count += 1; document.getElementById("countLabel").innerHTML = count; } // You can add functionality for the "decreaseBtn" button if needed. </script> </body> </html>
30th Sep 2023, 8:34 AM
D1M3
D1M3 - avatar
0
What changes you do
30th Sep 2023, 8:36 AM
Satveek Prakash
Satveek Prakash - avatar
0
I made several changes to your code to make it functional: I added HTML elements for the buttons and the count label with the appropriate IDs: "decreaseBtn," "restBtn," "increaseBtn," and "countLabel." I removed the commented-out lines that were causing syntax errors. I fixed a typo in the document.getElementById("countLable") line, changing it to document.getElementById("countLabel") to match the correct ID. I wrapped your JavaScript code inside <script> tags and placed it at the end of the HTML body to ensure that it runs after the HTML elements are loaded.
30th Sep 2023, 8:37 AM
D1M3
D1M3 - avatar
0
I done HTML and css
30th Sep 2023, 8:38 AM
Satveek Prakash
Satveek Prakash - avatar
0
Same
30th Sep 2023, 8:38 AM
Satveek Prakash
Satveek Prakash - avatar
0
But error coming
30th Sep 2023, 8:38 AM
Satveek Prakash
Satveek Prakash - avatar
0
You Wright "countLabel" wrong
30th Sep 2023, 8:38 AM
D1M3
D1M3 - avatar
0
Your sended code working or not
30th Sep 2023, 8:40 AM
Satveek Prakash
Satveek Prakash - avatar
0
Works fine
30th Sep 2023, 8:41 AM
D1M3
D1M3 - avatar
0
Np
30th Sep 2023, 8:42 AM
D1M3
D1M3 - avatar