Why doesn't this code work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn't this code work?

I have trie d to do a conversation game. I have tried to use a function that makes div elements visible in order to have content appear one by one , when a certain button is pressed. This worked one time but whe n i tried to use it again it didn't work This is the code: https://code.sololearn.com/WQvXKiP01qR0/#html What is wrong with it?

31st Jan 2019, 4:52 PM
dimitris9
3 Answers
+ 1
Hello, This is your code: <div id="myDIV" style=" visibility : hidden;">hello there <br> <button>hello</button onclick="hel()" type="submit"> <button onclick="noCommm()">...</button> </div> Clearly, you've placed attribute onclick="hel()" in closing button tag. Update onclick="noCommm()" to onclick="hel()" and the code will work.
31st Jan 2019, 5:07 PM
Kawalpreet Juneja
Kawalpreet Juneja - avatar
+ 1
Here I've corrected and beautified code a lil bit: https://code.sololearn.com/WIs11XciFZao/?ref=app
31st Jan 2019, 5:11 PM
Kawalpreet Juneja
Kawalpreet Juneja - avatar
+ 1
Thank you a lot for your help! I was focusing on the functions and didn't see that I had misplaced it.
1st Feb 2019, 9:23 PM
dimitris9