Textarea value to paragraph html as text only?

Not exactly - text() just strips off any HTML and leaves the text content only. If I understand the OP correctly, he wants to see the actual HTML source code. – Pekka Feb 8 '10 at 11:08 @Pekka - the jQuery documentation says otherwise: "We need to be aware that this method escapes the string provided as necessary so that it will render correctly in HTML.To do so, it calls the DOM method .createTextNode(), which replaces special characters with their HTML entity equivalents (such as.

You need to escape the HTML: $('p'). Html($('textarea').val(). Replace(//g,'>')); EDIT: use .text() instead as already mentioned unless you want to do a manual conversion.

Perhaps, but it's fast and works well. & conversion is not necessary to display HTML tags. – David Feb 8 '10 at 12:16 There is more to HTML than 'tags'.

Just wait until the data includes the string © — you'll end up displaying a copyright symbol instead of that string (ditto any other genuine HTML entity). – Quentin Feb 8 '10 at 12:45.

David Dorward answered this already, and I'd have added a comment instead of an answer but wasn't sure the code would show up right, so.. With this $('. Some_button'). Click(function () { $('p').

Text($('textarea').val()); }); and foofoo Clicking the button shows "foofoo" in the paragraph. Is that what you need? --Addendum-- Ok.. I am only a starting JavaScripter, so not sure how bad this is :-) But the following replaces special characters by their HTML equivalents while replacing linebreaks with a .

Remembered I've had to do something similar before, and still had the htmlents() lying around from that time. Feel free to criticise :-).

Textarea elements are defined as containing PCDATA, so that needs to be >br not.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions