I am developing some kind of html online editor and I have a problem getting the contents of the text area using jQuery.
The Textarea element is as follows:
<textarea id="myText"><b><p>TEST</p></b></textarea>
So this is a mixture of shielded and unshielded text. However, the browser displays text space similar to this, which is also not needed:
<b><p>TEST</p></b>
I want to get the internal html of the text field as is. If I try .html() , it will escape all tags, and if I try .val() , it will decode escaped tags. You can see the behavior of http://jsfiddle.net/hnBte/
How can I get pure content using Javascript and, if desired, how can I make textarea display the content as is?
thanks
source share