https://codepen.io/rohit357/pen/MVzRZw
How to add toggle switch in this?
1 Like
There are quite a few different ways of doing it. What I did was to use the .on(“click”)-function to change the CSS, so that when you clicked the button it removed the Celsius box and instead showed the Fahrenheit box. You can see it here:
a basic toggle would be something like…
var tog = 0;
function changeTemp() {
if(tog = !tog) // if true or 1... ( this changes between true and false every click )
{ do something;}
else
{ do other thing; }
}