+ 6

Why this doesn't work???

Its a clicker game, I wanted to add another upgrade but it gives an error, i dont know how to fix it. There are the two codes, the first is the one that gives an error and the second is the good one. (I want to add a better auto clicker, that its cost is 500 and every upgrade, the intervals in each mega auto click divides by 4.) https://code.sololearn.com/WVL3YWQBPK50/?ref=app https://code.sololearn.com/WbYkU1Mdq56Q/?ref=app

9th Mar 2023, 9:40 AM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar
10 Antworten
+ 6
in line 77 you have document.getElementById('mega-Auto-Clicker-Cost').innerText The id of the element is 'mega-auto-clicker-Cost'. Compare – Javascript is case sensitive.
9th Mar 2023, 12:16 PM
Lisa
Lisa - avatar
+ 3
Great that you could fix it! 👍👍
9th Mar 2023, 2:40 PM
Lisa
Lisa - avatar
+ 2
At which line in the script do you define what "MegaAutoClickerButton"? Did you spell the name correctly?
9th Mar 2023, 10:37 AM
Lisa
Lisa - avatar
+ 2
Javascript is case-sensitive, the spellings need to match exactly: const MegaAutoClickerButton = document.getElementById("Mega-auto-clicker");
9th Mar 2023, 11:03 AM
Lisa
Lisa - avatar
+ 2
Okay, I corrected it.
9th Mar 2023, 11:04 AM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar
+ 2
Check again how you spelt the id in the html part and how you spelt it in line 77
9th Mar 2023, 11:07 AM
Lisa
Lisa - avatar
+ 1
Ummm I think its written correctly
9th Mar 2023, 10:58 AM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar
+ 1
But now it gives another error, reading "inner text" at line 77
9th Mar 2023, 11:05 AM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar
+ 1
I dont find the error
9th Mar 2023, 11:42 AM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar
+ 1
Okay its done, the type error was that in one line, I put "meegaautoclicker" thats why it wasnt working.
9th Mar 2023, 2:10 PM
_MinatoGamerYT_
_MinatoGamerYT_ - avatar