I am writing a script in PHP where the user will create a text. It is very simple. The user types a text, it is stored in a database, then the visitors can retrieve the text when the go back to the page.

Because the user may write html when composing, I want a javaScript based preview, but I don't know if it is possible.

So, I want a javaScript to take the body of the user input, then display it on a preview panel which is on the same page.

I know how to do it with php, but I want it client-based. Is it possible?