Daniish
asked on
How do i add line breaks to Javascript variables that are displayed in a <div> ?
Hello,
I'm trying to add line breaks, currently using '\n', to make each variable i display in a <div> appear on a new line. At present my code looks like the attached.
The line breaks do not occur - what am i doing wrong?
Many thanks
I'm trying to add line breaks, currently using '\n', to make each variable i display in a <div> appear on a new line. At present my code looks like the attached.
The line breaks do not occur - what am i doing wrong?
Many thanks
<div id="infolinks">' + flag_folder.flag + '<b>At the time i visited...</b>\n' + '<b>Language: </b>' + language + '\n <b>Currency: </b>' + currency + '\n' + '<b>Exchange Rate: </b>' + exchange + '\n' + '<b>Plug Type: </b>' + plugtype + '\n' + '<b>Religion: </b>' + religion + '\n' + '<b>Head of State: </b>' + headofstate + '\n' + '<b>Population: </b>' + pop + '\n' + '<b>Per Capita Income: </b>' + pci + '\n' + '<b>National Dish: </b>' + food + '\n' + '<b>National Day: <\b>' + nday + '\n' +'</div><div id="infofooter">I was here on the ' + date + '</div>
the \n should only put a line break in the code, not in the display... you'd need to replace them with <br /> to line-break the HTML display
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window