You can do something like this, var mydiv = document.getElementById("myDiv"); var aTag = document.createElement('a'); aTag.setAttribute('href',"linkhere.html"); aTag.innerHTML = "link text"; mydiv.appendChild(aTag);