<textarea id='txt'> <b>Hi</b> </textarea> <button onclick='showvalue()'>ClickMe</button> <script> showvalue = function () { alert(txt.value); document.write(txt.value); } </script>