<textarea id="message" rows="6"></textarea> <script> document.getElementById('message').value = 'text \nwith \nline \nbreaks' </script>