<textarea id='txt'> <b>Hi</b> </textarea> <button onclick='showvalue()'>ClickMe</button> <script> showvalue = function () { var text = txt.value; document.body.innerHTML = ''; document.body.appendChild(document.createTextNode(text)); } </script>