I have a textarea to enter user comments and a html editor toolbar attached to that. The data entered is saved to database and I can retrieve the text, images,hyperlinks etc. But the newline and paragraph and not recognised. I have to display the comments in a paragraph like:
Do you have any idea how to do it (like we post new topic in this forum and it comes out with linebreak and paragraphs.)
Just calling that function from inside a p element won't do the trick. You need to do something with the return value, like document.write() it into the page or, better yet, wait until the document is loaded and set the innerHTML property of the intended document element to the return value.
However, I do agree with Eric. This should be done on the server. If you're storing the text in a database you should be processing it first anyway to prevent SQL injection.
Joined: Nov 08, 2001
Austin, it is too late to do it on the client. So the suggestion of document.write will not work.