Toggle between F and C in Show Local Weather

I’m stuck on how to get the toggle to work and actually switch the temp. Here’s a link to my codepen. https://codepen.io/japoemape/pen/dNegZx?editors=1010

look at my html code, lines 45-51
then look at my CSS code, starting at line 68
then browse my js code, lines 92-95*****
***** don’t forget to check out line 41 in the JS code, you’ll need something similar

you’ll get an idea of how it’s done

The idea is to give boolean value to the variable, say var swap = false, somewhere at the begining.
Now create a function that would toggle, based on the click.
so $(’#temparature’).click(function(){
now check if your swap=== false, and say show number of degrees in F for temparature
AND THEN — assign swap= true,
else check for swap===tru, and show number in degrees in C for temparature
And THEN — assign swap = false.
});
I used button, and not toggle and somehow it is not working with toggle.
Here is what I have and it works:
html


button class=“btn btn-primary” id=“temparature”>0&deg</button
js


var tempSwap = false;
$("#temparature").click(function() {
if (tempSwap === false) {
$("#temparature").html(ctemp);
tempSwap = true;
} else {
$("#temparature").html(ftemp);
tempSwap = false;
}
}); // end of tempSwap

you can use the same logic. Good luck.
Zorana

Or you could do it with a few less lines of js code:

$(':checked').click(function() {
          cel = !cel;
          render(localWeather, cel);
        })