How to preserve simple HTML formatting to textbox input?
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
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)
精彩评论