<html> <body> <textarea id="txt"></textarea> <script> var s = '<a href="path">text</a>'; document.querySelector('#txt').value = s; </script> </body> </html>