Question:
I have a textarea and I would like to list some items in it one on each line.
I'm already entering the text normally in the textarea and I currently separate the items into commas:
nomUgs = selUgs.join(", ");
In place of this comma I wanted to insert a line break. Has as?
Answer:
You can use \n
to break the line.
Example: http://jsfiddle.net/Wm9um/
For example this code separates each word in different line:
var texto = 'Eu quero que este texto seja separado em muitas linhas!';
var linhas = texto.replace(/\s/g,'\n');
$('#testes').val(linhas);