I have tried both \n and <br/>, they also cannot show correctly.
For example, if my list is A, B, C
1) \n will show A B C
2) <br /> will show A<BR>B<BR>C
But what I want is:
Is there any method to do it well?
I have tested it in Google Chrome, it run correctly with "\n". But my company use IE 8. IE 8 fails to do it.
1 person found this helpful
Thanks for your help.
Lastly, I find that I can use innerText to solve the problem.
InnerHTML is not an issue always. Please have a look into the following code. I could show the display with line break
<cfset message = "Welcome">
<cfset names = arraynew(1)>
<cfset count = 1>
<cfloop index="loopcount" from=1 to=12>
<cfset count = count + 1>
<cfloop array="#names#" index="name">
<cfset message = message & ' ' & #JSStringFormat(name)# & '<br>'>
document.getElementById("test").innerHTML = '<cfoutput>#MESSAGE#</cfoutput>';
Please let me know which html ctrl you are using the message to be displayed