lundi 3 octobre 2016

Why isn't this "if statement" working? [duplicate]

This question already has an answer here:

I have built a weather app that works perfectly. I decided to add in icons that change with the weather id variable from an API which has been assigned. It works for the first id in the if statement, but when I add else if statements inside it don't work for the else if parts here is my code:

       //weather icons check       
          if(weatherId=800){
             $('#type').css('background-image', 'url(http://ift.tt/2dEO7Qp)');
          }
          else if(weatherId>=801 && weatherId<=804){
              $('#type').css('background-image','url(http://ift.tt/2cOi8HJ)');
          }
          else if(weatherId>=300 && weatherId<=531){
               $('#type').css('background-image','url(http://ift.tt/2dEPJtP)');
          }

am I missing something in this statement???

Aucun commentaire:

Enregistrer un commentaire