I want to avoid HTML tags for entity names by taking text from textarea and putting the result in a second textarea so that:
<mytag>
becomes
<mytag>
I use .html() and .text() in the reverse order and forward. My problem is with the textarea element, which acts a little differently.
It works fine if I first put the text in a div:
var htmlStr = $('#textareaInput').val();
But I want to do something more straightforward:
var htmlStr = $('#textareaInput').val(); $('#textareaOutput').val($(htmlStr).html());
I think my problem is that I donβt understand how to manipulate jQuery objects, such as strings, without manipulating DOM elements, because right now I am using a div because it has a .html() method.
Any help would be fantastic!
Thanks.
jquery html textarea entities
Wayne
source share