# \[Help\] jQuery append function not working

**URL:** <https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479>\
**Category:** General\
**Tags:** jquery, append, wheather, api\
**Created:** [May 27, 2017, 12:39pm UTC](https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479 "2017-05-27T12:39:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matiasnunes](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/matiasnunes/32/54703_2.png) [@matiasnunes](https://forum.freecodecamp.org/u/matiasnunes)\
**Post date:** [May 27, 2017, 12:39pm UTC](https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479/1 "2017-05-27T12:39:06Z")

</div>

Hi all,

I’m new around the forum. Nice to meet you 😃

I’m working on the “API Weather” challenge and I got stuck when trying to show the proper icon.

Here is my pen: [https://codepen.io/matiasnunes/pen/KmrEQP](https://codepen.io/matiasnunes/pen/KmrEQP)

After retrieving the data from Dark Sky, I try to append to a string from an array field to a figure tag, which is nothing else than a HTML canva piece with an ID, but nothing happens. The code is actually appended, but not shown.

Of course I’ve tried to add the canva tag manually into the HTML code and that way works just as expected, so there’s nothing wrong with it.

What I’m I doing wrong? Any help is much appreciated.

---

<div class="post-metadata">

**Author:** ![honmanyau](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/honmanyau/32/45787_2.png) [@honmanyau](https://forum.freecodecamp.org/u/honmanyau)\
**Post date:** [May 27, 2017, 1:21pm UTC](https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479/2 "2017-05-27T13:21:22Z")

</div>

Haiiiiyo!

I don’t think that’s how you use the Skycons or tat it’s a very convoluted way to implement it. ☹ I think taking another look at the [documentation](https://darkskyapp.github.io/skycons/) would help a lot.

In case that’s what you already did and the currently implementation is due a misunderstanding, the basic implementation is as follows:

```auto
/* HTML */
<canvas id="weather-icon" width="96" height="96"></canvas>

```

```auto
/* JavaScript */
const skycons = new Skycons({"color": "salmon"});

// And assuming that data is whatever you get from Dark Sky's API call
skycons.set("weather-icon", data.currently.icon);

```

I actually found out by accident that you can simply supply `data.currently.icon` without doing any transformation. For example, you get the same result with all of the following:

```auto
skycons.set("weather-icon", "clear-night");
skycons.set("weather-icon", "CLEAR_NIGHT");
skycons.set("weather-icon", Skycons.CLEAR_NIGHT);
skycons.set("weather-icon", Skycons["CLEAR_NIGHT"]);

```

Animation also works fine in all cases.

I hope that helps. 🙂

---

<div class="post-metadata">

**Author:** ![matiasnunes](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/matiasnunes/32/54703_2.png) [@matiasnunes](https://forum.freecodecamp.org/u/matiasnunes)\
**Post date:** [May 29, 2017, 12:33am UTC](https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479/3 "2017-05-29T00:33:11Z")

</div>

Thanks, @honmanyau. My code was indeed convulted, so your critique is very welcome.  
Anyway, after implementing Skyicons the way you pointed it still wasn’t working, until I found that I’ve misspelled a variable name and that was causing the code to break ☹

It’s solved now. Thanks again for your time and help!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:54pm UTC](https://forum.freecodecamp.org/t/help-jquery-append-function-not-working/120479/4 "2021-01-17T20:54:08Z")

</div>

Closed on January 17, 2021, 8:54pm UTC


