That worked, Ricardo...to a point. (Haven't tried your solution, Charlie...)
I actually just embedded the replace function in the code like this: out.push('<div id="sectionTextDIV">' + row[4].replace(/\r?\n/, '<br/>') + '</div>'); and that worked, but only for the first line break in the text. I tried adding 'all', like I do when I use the replace function in CFML, but it had no effect. ...'<br/>', 'all') + '</div>'); Suggestions? Thanks, Rick On Sun, Apr 19, 2009 at 5:58 PM, Ricardo <ricardob...@gmail.com> wrote: > > Have you tried replacing the line breaks in javascript? > > var txt = row[4].replace(/\r?\n/, '<br/>'); > out.push('<div id="sectionTextDIV">') > out.push(txt); > out.push('</div>'); > > On Apr 18, 10:12 pm, Rick Faircloth <r...@whitestonemedia.com> wrote: > > Normally, when I'm trying to cause a passage of text to respond to line > > breaks, I use this ColdFusion code: > > > > #replace(myText, '#chr(13)#', '<br>', 'all')# > > > > and that keeps the line breaks intact when the text is output to the > screen. > > > > But how can I write that code inside this js? Or do I have to do it > outside > > the js? > > ("row[4]" represents the text) > > > > out.push('<div id="sectionTextDIV">' + row[4] + '</div>'); > > > > out.push('<div id="sectionTextDIV"><cfoutput>#replace(' + row[4] + ', > > '#chr(13)#', '<br>', 'all')#<cfoutput></div>'); > > > > That wouldn't work anyway, since the HTML is being inserted into the DOM > via > > jQuery, > > so the page isn't being refreshed to trigger the ColdFusion processing. > > > > The text, coming from an AJAX function is delivered to the display > function > > in > > response.QGETSTORYINFO.DATA, and is delivered from a ColdFusion component > > method > > via storyStruct.QGETSTORYINFO, so, there's not a chance, that I can see > to > > run the > > replace operation on the code in the method. > > > > Can I somehow run the replace on all the qGetStoryInfo.section_text data > > after it's queried, > > then "reinsert" it into the struct, storyStruct.QGETSTORYINFO ??? > > > > Suggestions? > > > > Thanks, > > > > Rick > > > > -- > > > ----------------------------------------------------------------------------------------------------------------------------------------------------------------- > > "It has been my experience that most bad government is the result of too > > much government." - Thomas Jefferson > > -- ----------------------------------------------------------------------------------------------------------------------------------------------------------------- "It has been my experience that most bad government is the result of too much government." - Thomas Jefferson