zsharp
zsharp

Reputation: 13756

How to preserve simple HTML formatting to textbox input?

I only want to maintain the paragraph 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?

Upvotes: 4

Views: 2181

Answers (3)

Skay
Skay

Reputation: 9493

use <pre></pre>

Upvotes: 5

Warty
Warty

Reputation: 7395

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!

Upvotes: 0

Nasser Hadjloo
Nasser Hadjloo

Reputation: 12610

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)

Upvotes: -1

Related Questions