Set text with .innerHTML and change the href
<p>I am getting the [website] from a pre-made plugin that I can't edit. If that element is empty I do not want to display anything, but if it has a url, I want to write the text 'Register Here' and have that link to the URL in [website]. Right now it is printing the text just fine, but not applying the href.</p>

<pre><code>&lt;p id="demo" &gt;&lt;/p&gt;
&lt;script&gt;

var str = "[website]";
var n = str.length;

if (n === 0) {
  alert("0");
  document.getElementById("demo").innerHTML = "Register Here";
  document.getElementById("demo").setAttribute ("href", 'str');
}
else {alert("else");}

&lt;/script&gt;
</code></pre>