+ 1
Why is the code playground text keep popping up?
Link here : https://sololearn.com/compiler-playground/WISeSOQPq23c/?ref=app
20 odpowiedzi
+ 3
Thanks Lisa
+ 2
Remove the alerts from your function.
You can put them elsewhere. At the moment, you've programmed them to appear when a user clicks the button.
+ 2
Thanks Ausgrindtube
+ 2
You've giving every button the onclick attribute and you've put alerts inside the targeted changeBackgroundColor function.
Thus each time you click a button it calls the function and the code runs.
To fix the issue
Remove the alerts from the function like this.
function changeBackgroundColor(color) {
document.body.style.backgroundColor = color
}
alert("This is a demo of Random files")
alert("we will be updating this every week")
+ 2
Thanks Chris Coder
+ 2
no, i can't :)
i am not a staff member of sololearn
+ 1
the alerts come up whenever one presses a button because the alerts are inside the color change function.
what behavior do you intend instead?
and why do you need to define new classes for each button when all buttons are styled the same?
https://www.sololearn.com/discuss/3330302/?ref=app
+ 1
It is the alert() that pops up.
+ 1
the alerts come up whenever one presses a button ***because*** the alerts are ***inside** the color change function.
move the alerts outside of the color change function.
+ 1
yes, one can make a game from html, css, javascript
+ 1
Be helpful in the community and someone from the mentorship team will notice your efforts and recommend you to the team leader. You can learn more here.
https://www.sololearn.com/en/Sololearn-Mentors
0
Click the start button then the load game button and you'll see that the playground code keeps popping up
0
Yeah but it pops up every time you press a button
0
When I want it to only pop up once and not on all the buttons
0
Ok
0
Also what are you doing ?
0
And also can you make a functioning game with just HTML CSS AND JAVASCRIPT?
0
Thanks cause your helping me make it right now
0
Also Chris coder how do you become a mentor?
0
Lisa wait you can make me a mentor?