0
Good morning, I’m having some difficulty trying to break a line using [b] n[/b] javascript. The code is working perfectly, what happens is that when it displays, it looks like this:
My nick: ViniciusnHow I found the server: YoutubenI want to play because: I like the server
Like n is not breaking the line, but it appears there at the end of every string I put, I wonder what is happening?
<script>
$(function () {
$('[name="post"]').click(function () {
var nick = $('#field0').val();
var descobriu = $('#field1').val();
var motivo = $('#field2').val();
$('input[name="subject"]').val('[ Whitelist] ' + nick + ' ');
$('input#message').val('[b]Meu nick:[/b] ' + nick + ' <br>[b]Como descobri o servidor:[/b] ' + descobriu + ' \n[b]Eu quero jogar porque:[/b] ' + motivo);
});
});
</script>
use <br> instead of n
– Skywalker
I tried to use <br> but in my forum it appears the <br> tag instead of breaking line
– viniciussvl
Have you tried
'\\n'
?– Klaider
It worked, thank you very nicematt!
– viniciussvl
Hey now it’s not working anymore, ta appearing like this http://i.imgur.com/Rwwmnrj.jpg
– viniciussvl
I put the two bars \
– viniciussvl
<script>
 $(function () {
 $('[name="post"]').click(function () {
 var nick = $('#field0').val();
 var descobriu = $('#field1').val();
 var motivo = $('#field2').val();
 $('input[name="subject"]').val('[ Whitelist] ' + nick + ' ');
 $('input#message').val('[b]Meu nick:[/b] ' + nick + '\\n[b]Como descobri o servidor:[/b] ' + descobriu + '\\n[b]Eu quero jogar porque:[/b] ' + motivo);
 });
 });
</script>
– viniciussvl
I don’t know either, it seems he’s not reading the first bar
– viniciussvl
http://stackoverflow.com/questions/8627902/new-line-in-text-area?answertab=active#tab-top
– Skywalker