I am able to dynamically produce an Unicode character and insert it into a <div> by using sequences like ð, but now I want to retrieve this input as an escape sequence, not the character itself.
Please see this JSFiddle example:
<button id="insertDh">insert funny d to mytext</button>
<div id="mytext"><i>mytext: please click button above</i></div>
<hr>
<textarea id="theSource"></textarea>
<button id="getSource">get mytext's source</button>
$("#insertDh").click(function() {
$("#mytext").html("ð");
});
$("#getSource").click(function() {
$("#theSource").val($("#mytext").html());
});
In other words, when I click "get mytext's source", I want to fill in the textarea with ð and not ð. Is this possible? If so, how?