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

Reply via email to