I have a <textarea id="mytextarea"></textarea>
.
Let's say a user typed in there: <hello>, world!
How to get res = "<hello>, world!";
from what user typed?
This code doesn't work:
var res = $('#mytextarea').val().html();
It says:
Uncaught TypeError: undefined is not a function
P.S. var res = $('#mytextarea').val();
works just fine, but I need the text from the textarea became html-escaped.
How to do it with jQuery?
Thank you.