2
My code has a Textarea, in it I send some messages, but when I jump a line, when receiving this message the line break is ignored
currently I use the following command in my javascript function to force line break
mensagem = document.getElementById("id_textarea_conteudo").value.replace("\n","<br>");
But it did not solve my problem, because instead of breaking all the jumped lines of the message, it is only breaking the first line.
example:
teste teste teste teste
is returning as follows
teste
teste teste teste
and I need you to return
teste
teste
teste
teste
has some way to solve this problem I’m having?
I ran a test this way and managed to make it work, what was missing was to correct the regular expression used instead of replace(" n","<br>") I changed to replace(/ r? n/g, '<br/>') and it worked.
– Jess