Weather app - changing HTML with JS

Weather app - changing HTML with JS
0

#1

Hey everyone. I’m working on my weather app and having a hard time figuring out how to get the data from my APIs into my HTML. If you take a look at the pen as it is currently saved, I am trying to use JQuery to change the html by id, but I’ve also tried it with a vanilla Js command to change the inner html of the divs currently labeled city, temp, etc, both by ID and class name. What am I missing here?

https://codepen.io/kaydeejay/pen/LezwPe

Thanks as always for any help!


#2

Your code is working. The following line inserts my current city (San Jose) inside the div with id=“city”.

$("#city").html(city);

#3

I concur, adding the following code below will output the data in the correct places.

$(".gridIcon").html(`<img src=${icon}>`);
$(".gridCond").html(currentCon);
$(".gridTemp").html(`${tempC}&deg;C`);
$(".gridHumid").html(humidity);