I need halp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I need halp

I’m working on replacing ids with js but I can’t figure out why it’s not working, haalllppp???? https://code.sololearn.com/WO74bH6VM2kn/?ref=app

8th Jul 2018, 5:13 PM
<i>TheOfficialOdyssey</i>
<i>TheOfficialOdyssey</i> - avatar
2 Answers
+ 2
So the easy way out is to just save that div in a variable. The id changes but the div itself doesn't! https://code.sololearn.com/W4BU2Gtbbwe1/#html I think the problem must have been somewhere in the indentation. Some of your { curly braces } were off, but you couldn't really tell because the code was a bit messy :D Always make sure to indent code correctly, it helps catch a lot of bugs. Anyway changing id's is usually not the best idea but if you just did it for testing purposes it's ok. Also using .onclick instead of .addEventListener is a bit frowned upon but lets not turn this into a code review :D
8th Jul 2018, 5:50 PM
Schindlabua
Schindlabua - avatar
0
thanks :D
8th Jul 2018, 9:56 PM
<i>TheOfficialOdyssey</i>
<i>TheOfficialOdyssey</i> - avatar