Local Weather Project Help

Local Weather Project Help
0

#1

I can’t make my temperature to switch between celsius and fahrenheit constantly. It does change when I click on it for the first time but then nothing.
There is the change button and a paragraph tag which shows the sentence.

var switchTemp = true;
$(".change").on(“click”, function(){
if (switchTemp === false){
$("#temp").html(“The current temperature is: " + far + " “);
switchTemp = true;
}else{
$(”#temp”).html("The current temperature is: " + celsius + " ");
switchTemp = false;
}
});


#2

The problem is somewhere else. Post the whole code.

I tried you snippet and it works fine:


#4

there it is


#5

Problem is with slider.

Replace “click” with “change” and set switchTemp initial value to false.

var switchTemp = false;
  $(".change").on("change", function(){
  ...
  ...

#6

Thank you very much!