Esteban S
Esteban S

Reputation: 1919

Storing HTML Wysiwyg Editor data

I am developing a Webapp with a Wysiwyg editor with CKEditor. Now I am facing the problem of how to store the data in the database. I mean, the data generated by the editor is in HTML. Should I store the data direcly in HTML? If I store only the text, how to get the tags to render the info when the page is refreshed? Thanks.

PD: The data from the editor is caught by a Javascript function.

enter image description here

Upvotes: 3

Views: 1883

Answers (2)

Dieu Luong
Dieu Luong

Reputation: 133

I think you should store data directly in HTML so you can keep text format when render.

If you want to store text data only, using textarea or textbox is easier.

Upvotes: 1

KaizenCodes
KaizenCodes

Reputation: 131

Try this:

parsed_html = $.parseHTML( html_text );

However, I'm unsure whether you can store the parsed text in a database or not. I store them as raw html and then at display I convert them.

Upvotes: 1

Related Questions