开发者

How to preserve simple HTML formatting to textbox input?

开发者 https://www.devze.com 2022-12-21 08:57 出处:网络
I only want to maintain the paragr开发者_运维技巧aph structure of the users input into a textbox. When I retrieve the text from db, all structure is lost. What\'s easiest way to save text as recorded?

I only want to maintain the paragr开发者_运维技巧aph structure of the users input into a textbox. When I retrieve the text from db, all structure is lost. What's easiest way to save text as recorded?


use <pre></pre>


replace spaces " " with &nbsp; You can't repeat multiple spaces " " in HTML, as they will be collapsed into one space.

Also, replace \n with <br />

Hope that helps!


If you want to store HTML text (rich text with BOLD , Italic and etc) you have to use an editor like CKEditor (http://www.ckeditor.com)

0

精彩评论

暂无评论...
验证码 换一张
取 消