Reputation:
What would be the best way of doing 2 different background colors?
Code: https://playcode.io/test4343?tabs=index.html,preview
When it's first viewed it's one color,
https://i.sstatic.net/7p3Gs.png
After you click on circle, if I wanted to give it a different color how would I do that?
https://i.sstatic.net/9q3T1.png
body {
background: #353198;
}
Upvotes: 0
Views: 62
Reputation: 66
you can use
document.getElementsByClassName("jacketa").addEventListener("click", myFunction());
function myFunction (){
document.body.style.background="red";
}
Upvotes: 0
Reputation: 3886
You have to use an onclick function on the circle and then in that function include the following code.
document.body.style.backgroundColor = "YOUR_DESIRED_COLOR";
Upvotes: 1