JSFiddle - React, Tailwind, and code Playground
by dmethvin
HTML
<p><a href="#">initialtext</a></p>
JavaScript
var p = document.getElementsByTagName("p")[0];
var a = document.getElementsByTagName("a")[0];
// remove this line and the "initialtext" will stay, unmolested
a.innerText = "http://therighttext.com";
a.href = "http://theBADtext.com";
alert(a.getAttribute("href"));