467,869 Members | 1,392 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,869 developers. It's quick & easy.

Javascript linebreak

Hello guys, i hope you can help me with this cause it's driving me
crazy!

I got the following statement in javascript:

if(currTotal < 27{document.getElementById('isResult').innerHTML =
"Blabla, blablabla, 12345")

it displays the message as:

Blabla, blablabla, 12345

But i would like to break it up into three lines, so it would be
displayed as:

Blabla,
blablabla,
12345

Is there anyone that knows how to fix this? I tried \n , but with no
result..

May 2 '06 #1
  • viewed: 3827
Share:
2 Replies
Shirenseru said the following on 5/2/2006 9:07 AM:
Hello guys, i hope you can help me with this cause it's driving me
crazy!

I got the following statement in javascript:

if(currTotal < 27{document.getElementById('isResult').innerHTML =
"Blabla, blablabla, 12345")

it displays the message as:

Blabla, blablabla, 12345

But i would like to break it up into three lines, so it would be
displayed as:

Blabla,
blablabla,
12345

Is there anyone that knows how to fix this? I tried \n , but with no
result..


Add a <br> or <p> to it as you are rendering HTML and \n is not a new
line in HTML. \n will add a new line to the source though.

"Blabla,<br> blablabla,<br> 12345<br>"

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 2 '06 #2
Oh my god..

was it that easy.. '-_-

Thanks a lot man!

May 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by nAmYzArC | last post: by
1 post views Thread by Lucie | last post: by
4 posts views Thread by Dirk Reske | last post: by
2 posts views Thread by Georg Weiler | last post: by
17 posts views Thread by Chris Ianson | last post: by
3 posts views Thread by Michael Hamm | last post: by
3 posts views Thread by Per W. | last post: by
7 posts views Thread by Leif902 | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.