There seems to be an issue with my code as the div containing an anchor tag with an image does not appear in the section area when I execute this function
function addLink(){
if(localStorage.getItem('howManyLinks') >= 1){
localStorage.setItem('howManyLinks', Number(localStorage.getItem('howManyLinks')) + 1);
}
else{
localStorage.setItem('howManyLinks', '1');
}
var howManyLinks = localStorage.getItem('howManyLinks');
var myNewLink = document.getElementById("link");
localStorage.setItem('link'+howManyLinks, myNewLink.value);
var myNewIcon = document.getElementById("icon");
localStorage.setItem('icon'+howManyLinks, myNewIcon.value);
/* The problem lies below */
var div = document.createElement('div');
var img = document.createElement('img');
var a = document.createElement('a');
img.setAttribute('src','icon'+howManyLinks);
a.setAttribute('href','link'+howManyLinks);
section.appendChild(div);
div.appendChild(a);
a.appendChild(img);
}