Extra div when injecting HTML inside container
Hi, peeps o/ A little help here u.u
So, there's an extra div been inserted around the new .country div that I don't know where it's coming from.
I was looking at the JS code but didn't see anything different from other projects where I inserted code like that.
Can someone enlightening me ? maybe I'm too blind .-.
LIVE: https://rwxganta.github.io/country-flags/
https://github.com/rwxganta/country-flags
GitHub
GitHub - rwxganta/country-flags: Practice API requests with XMLhttp...
Practice API requests with XMLhttprequest while getting some country infos - GitHub - rwxganta/country-flags: Practice API requests with XMLhttprequest while getting some country infos
![](https://cdn.answeroverflow.com/1117643782498820166/extra-div.png)
2 Replies
you are creating the countryEl element as div. you then set the inner html(child) to the one in line 40. i dont see anything wrong here
Hey, thank you mate! I was probable too tired and didn't think right about it. I fix it taking the .country div out of the innerHTML string and adding the .country class to that empty div, makes more sense to me now.
![](https://cdn.answeroverflow.com/1117851947085598720/fix-extra-div.png)