xxxxxxxxxx
var span = document.getElementById("customSpan");
span.textContent = "some text";
xxxxxxxxxx
var span = document.getElementById("span");
var a = document.createElement('a');
a.href = "http://domain.com";
span.appendChild(a);