How do I make a button stay? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I make a button stay?

In case you saw my previous question, I made the clicker work but now the button disappears onclick, how do I make it stay? Here's all my code: https://code.sololearn.com/WdRcwPdcdGIk/?ref=app

12th Aug 2017, 8:56 PM
koala 🐨
koala 🐨 - avatar
2 Answers
+ 2
When you do document.write it overwrites the entire document with "Money: x" and deleted the button tag, you have to be more specific to the specific element. I'll show an example in a sec. Update: alright, should work. You also need to remember semi colons. I used document.getElementById to get to the p tag and changed the inner html to money: x. https://code.sololearn.com/WHRY5KoyZbsg/#html
12th Aug 2017, 9:14 PM
Jordan Chapman
Jordan Chapman - avatar
+ 1
Hey @Koalafied why did you deleted a question I answered wrong?? I was looking for solution and I just found it. Veryyyyyyyyyy messy code but it works the same as @Jordan Chapman's https://code.sololearn.com/W8615V8h61Ac/?ref=app
12th Aug 2017, 9:29 PM
Tim Thuma
Tim Thuma - avatar