Reputation: 2403
I have a textarea
and I do console.log($("textarea").val())
, the result can be
abc
123
And I have an input, i want to concate the value with the value of textarea, like this
input_value
abc
123
I tried <br>
but the br will appear which is not I want. How to make newline in concatenation? use \n
?
Upvotes: 2
Views: 18598
Reputation: 43
You can try something like this:
alert('abe \n' + 123);
\n Seems to do the trick for you.
Further Reading: http://www.w3schools.com/jsref/jsref_regexp_newline.asp
Upvotes: 0
Reputation: 764
Use \n
instead of <br>
. Like that:
console.log($("input").val() + '\n' + $("textarea").val());
Upvotes: 3