Reputation: 3913
In an array variable, I am concatenating 2 variables and then storing it in an array .I want to add a linebreak between two variables. I tried \n
and it is not working .
var arrBackImg = new Array();
var frontText = new Array();
for(......){
frontText[i] = title+"\n"+description;
backText[i]=title+":"+longdesc;
}
how to add new line character in this variable???
Upvotes: 2
Views: 13664
Reputation: 28763
you can try like
frontText[i] = title+"<br>"+description;
BUT *you should put that value as html like*
$('#txt').html(frontText[i]);
Upvotes: 4
Reputation: 2205
Try using <br>
var arrBackImg = new Array();
var frontText = new Array();
for(......) {
frontText[i] = title+"<br>"+description;
backText[i]=title+":"+longdesc;
}
<br>
is the tag used for line breaks in HTML
Upvotes: 1