Is there a way in pure Javascript to turn links in an HTML document into clickable links? I do not want to use regex to solve this problem.
Let's say I have this list in an HTML5 doc:
<pre>
http://www.test.com
http://www.example.com
http://nicelink.com
</pre>
And I want it to automatically turn into this when the page is loaded:
<pre>
<a href="http://www.test.com">http://www.test.com</a>
<a href="http://www.example.com">http://www.example.com</a>
<a href="http://nicelink.com">http://nicelink.com</a>
</pre>
What would the vanilla JS code look like if I put a script in the header? Something looping through the HTML code and replacing the lines I suppose but I cannot write it in JS.
Signy