Show the Local Weather(Icon error)


Hey friends.Could you help me out with an icon.I am trying to have my weather icon switched if i have different weather conditions.


Maybe change:

var apiIcon="" + icon+ ".png";
$('#currentTemp').prepend('<img src='+ apiIcon+'>');

to this one liner:

$('#currentTemp').prepend('<img src='+ icon +'>');


wow.Thank you so much.You saved me a lot of are genius!!!


FYI - I was looking at the rest of your code and found something that is probably not working the way you think it will. I have a question at the bottom of this message regarding a couple of pieces (shown below). I hope you don’t mind unsolicited feedback for something you may still be working on, but I wanted you to be aware of a potential problem you may experience with the current code.

      var id =[0].id,
     // console.log(backgroundId);

Earlier in the code you have:

    backgroundImg =[

My question is if another id besides the ones in backgroundId comes back from the API call, why do you think your current code with the use of sort and indexOf is going to be able to tell you the index of an image that you do not currently have in your backgroundImg array?