[jQuery] I would like to return xhtml character entities
I would like to grab a string that contains '<' and '>' and NOT have
jQuery eval and force my browser to render it has html. It's
difficult for me to convey what I want, but basically I am trying to
send it latin or unicode entity references for the angle brackets and
want to write those brackets as literal brackets, not rendered as
html...
I dunno if that makes sense so here is the code I am testing with:
html -
<div class="test">
<div>
<div>
<p>This is a sample paragraph.</p>
<p>This is another sample paragraph.</p>
<p>This is one last sample paragraph.</p>
</div>
</div>
</div>
jQ -
$(document).ready(function() {
$codetext = $("div.test div").text();
$("div.test div").empty();
$("div.test div").append($codetext);
});