Javascript examples for DOM HTML Element:Textarea
Assign Textarea text to table cell without carriage returns
<html> <head> <script type="text/javascript"> function test(){// w w w. j av a2s . c o m var x = document.getElementById('comments').value; x = x.replace(/\r?\n/g, '<br />'); var y = '<table><tr><td>'+x+'</td></tr></table>'; document.getElementById('tbl').innerHTML = y; } </script> </head> <body> <div id="tbl"></div> </body> </html>