i want javascript to display html content when button is clicked but it just shows code instead of the content what am i doing wrong?
let btn = $('button');
let socials = $("#popup");
let theDiv = document.getElementById("btnclick");
let content = document.createTextNode('<button class="circle"><img class="share" src="images/icon-share.svg"></button>');
btn.click(function() {
socials.toggle();
theDiv.appendChild(content);
});
#popup {
position: absolute;
z-index: 5 !important;
top: 160px;
background-color: red;
width: 235px;
height: 55px;
border-radius: 10px;
}
.circle {
z-index: 1;
position: absolute;
float: right;
background: hsl(210, 46%, 95%);
border-radius: 50%;
height: 30px;
width: 30px;
margin: 0;
right: 0px;
bottom: 58px;
left: 352px;
}
<div id="popup" class="window">
<div class="windowtext">SHARE
<img class="icons iconfirst" src="images/icon-facebook.svg" />
<img class="icons" src="images/icon-twitter.svg" />
<img class="icons" src="images/icon-pinterest.svg" />
<div id="btnclick"></div>
</div>
<span class="triangle"></span>
</div>
</div>
<button class="circle"><img class="share" src="images/icon-share.svg"></button>