socksocket
socksocket

Reputation: 4371

Html entities to Html tags

I'm using wysiwyg text editor named "niceEdit".
when I want to present the content extracted from the database the html tags are in the form of html entities. for example: <

so, the result (in the webpage) might be something like:

<b>hello world</b>

instead of:

hello world

what is the easy/elegant way to convert it?

P.S.
I use JAVA (Play! framework) in the backend.

Upvotes: 0

Views: 198

Answers (1)

Cynthia
Cynthia

Reputation: 5403

Here's a way to do it: http://jsfiddle.net/QSJxW/

In a nutshell you create a form that does nothing and has no submit button. Add a textarea to your form and put all of your code between <textarea> and </textarea>. You can use CSS to style your textarea so that it doesn't LOOK like a text area.

I have 2 examples in my jsFiddle. One unstyled and one styled. If you add overflow:hidden to the textarea CSS, it turns off the scrolling.

Hope this helps!

Cynthia

Upvotes: 1

Related Questions