javascript - Add line breaks to data being pulled from SQL database -
i retrieving field database html page. place field between <p></p>
following,
84 series harmony3 desk top module 2 x uk power socket 3.15a individually fused 1m black hardwired mains cable gst wieland plug anodised silver body black plastic fascias black inner , outer end caps
encoded string 84+series+harmony3+desk+top+module%0d%0a2+x+uk+power+socket%0d%0a3%2e15a+individually+fused%0d%0a1m+black+hardwired+mains+cable%0d%0ato+gst+wieland+plug++++++++++++%0d%0aanodised+silver+body%0d%0ablack+plastic+fascias%0d%0ablack+inner+and+outer+end+caps%0d%0a++++++++++++++++++++++++++++++%0d%0a%0d%0a%0a
i using classic asp & dreamweaver bindings.
if place same field in <textarea></textarea
understands there line breaks in field, , displays text correctly,
84 series harmony3 desk top module 2 x uk power socket 3.15a individually fused 1m black hardwired mains cable gst wieland plug
anodised silver body black plastic fascias black inner , outer end caps
i wondering how can achieve same result without using <textarea></textarea>
.
i think need tell text break using %0d
, %0a
when have tried using javascript, doesn't appear work.
any suggestions using javascript, jquery or css great.
your problem html ignoring whitespace of times - linebreaks "not there" when enclosed in <p>
.
to have linebreaks in displayed page need add <br>
-tags linebreaks in content.
as alternative might try enclosing data in <pre></pre>
instead of <p></p>
, preserve whitespace (tabs, blanks, linebreaks).
Comments
Post a Comment