Change background according to the temperature[HELP]

Change background according to the temperature[HELP]
0

#1

Hi,

I tried to use ‘’ if ‘’ to change the background but for some reason it is not working out, someone could help me please?


#2

Do you realize you have the same background image in your CSS as the one you specify in your if statement block? Plus, you are only changing the background when a button is clicked? Also, since your celsius variable is a string (i.e. “11 °C”), it will never be greater than 10 (your if statement condition).


#3

Oh, I think the problem is celsius being a string, I will try to figure that out

Thanks.


#4

Your condition fails if celsius === 0 || celsius === 20.