js add a tag inside span
var span = document.getElementById("span"); var a = document.createElement('a'); a.href = "http://domain.com"; span.appendChild(a);
Here is what the above code is Doing:
1. Create a new element
2. Set the href attribute of the new element
3. Append the new element to the span element