user3142695 user3142695 - 5 months ago 95
HTML Question

Add line break in textarea in a jade template

I need to output an array content in a textarea in a jade template. It is something simple like this:

textarea
each content
{{this}}


But I need to add a linebreak after each element, as I want to display each element in a own line in the textarea. How do I add the linebreak?

Answer

In JADE you can use expressions like \n, \s or \t in "Unescaped Buffered Code". Take a look into the Docs: http://jade-lang.com/reference/code/

Here is an example Pen: http://codepen.io/pure180/pen/XKMpBr

- var contents = {'line1': 'abcd\n', 'line2':'defg\n'}
textarea
   each content in contents
     !{content}