Home > DeveloperSection > Forums > How to force a line break on a Javascript concatenated string?
Takeshi Okada
Takeshi Okada

Total Post:89

Points:629
Posted on    March-12-2013 3:02 AM

 JavaScript JavaScript 
Ratings:


 1 Reply(s)
 1639  View(s)
Rate this:

Hi All!

I'm sending variables to a text box as a concatenated string so I can include multiple variables in on getElementById call.

I need to specify a line break so the address is formatted properly.

document.getElementById("address_box").value =
(title + address + address2 + address3 + address4);
I've already tried \n after the line break and after the variable. and tried changing the concatenation operator to +=.

Thanks in advance!



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    March-12-2013 8:45 AM

Hi Takeshi!

Try this way

document.getElementById("address_box").value =
(title + "\n" + address + "\n" + address2 + "\n" + address3 + "\n" + address4);


Don't want to miss updates? Please click the below button!

Follow MindStick