So I’m making the weather app and I’m at the point I need to make the background images change based on the type of weather (instead of temperature because it can be hot and raining or cold and super sunny)
The only issue is after implementing code which I thought should work, I’m not getting any results.
The two ways I’ve tried are as follows and neither is working for me.
way one: converting weather type variable to html string, checking if it includes the character/string i need, if it does, use that background image.
if(weatherMain.html.includes("cloud")===true){
$('body').css('background-image', "url('*****')");
}
way two: same idea, but attempting to get the string from the html rather than the json… is it clear that I have no clue what I’m doing
if($('#weatherType').html(weatherMain).includes("Clouds")===true){
$('body').css('background-image', "url('****')");
}
Please show me the light and tell me why these aren’t working.
Incase it’s needed, here’s the link to the full thing https://codepen.io/Jobo_v22/pen/vddQEJ?editors=0010 the relevant code is at the bottom.