0

Question about my css

I have my CSS working but once I finished the JS when I hit the button to take in the inputs and then it goes to display the outputs it changes the background back to a white one instead of the colour, how can I fix this?

27th Apr 2017, 5:25 PM
Zac Parnell
Zac Parnell - avatar
6 Respostas
+ 7
Replace document.write line with below code. document.getElementById('demo').innerHTML = "Your change is "+totalq+" quarter(s),<br> "+totald+" dime(s),<br> "+totaln+" nickle(s),<br> "+totalp+" penny(ies)."; As document.write replaces your DOM completely.
27th Apr 2017, 5:37 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 6
Almost, impossible to solve like this. Please provide code playground link so that People here can help you out.
27th Apr 2017, 5:29 PM
Ashwani Kumar
Ashwani Kumar - avatar
+ 6
Because you use document.write() method ^^ ( it overwrite your html content :P ) Use innerHTML property of the element you want to update instead ( as I explain in my last answer in a previous question thread you've posted ;) ) [ edit ] The other thread: https://www.sololearn.com/Discuss/347075/?ref=app
27th Apr 2017, 5:35 PM
visph
visph - avatar
+ 1
can you show us your code? would be much more simpler to understand what you mean
27th Apr 2017, 5:29 PM
Welliton Malta
Welliton Malta - avatar
0
oh yeah oops I thought I put the link in just a sec https://code.sololearn.com/WWuH1Uln935H/?ref=app
27th Apr 2017, 5:31 PM
Zac Parnell
Zac Parnell - avatar
0
awesome thanks 😂
27th Apr 2017, 5:36 PM
Zac Parnell
Zac Parnell - avatar