I'm trying to make a toggleable button with the label class "Toggle" change the background of the website on click.
My html is:
<label class="Toggle" id="Toggle-bg" onclick="Togglebg()>
<input type="Checkbox">
<span class="Slider Rounded"></span>
</label>
<p id="Toggle-p">Toggle background</p>
and I would like to add this CSS to the document when it is clicked:
.Background{background: linear-gradient(45deg,lightblue,lightgreen,yellow,orange)}
I'd like it to be toggleable but load the page untoggled, thanks!
Javascript or jquery is fine.
question from:
https://stackoverflow.com/questions/65848920/change-background-colour-on-button-click-toggleable 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…