I have a piece of code which dynamically alters the HTML of a div called 'accordion' on the fly like so:
// htmlstring contains some HTML containing some HTML encoding
// e.g. <span class='clickableComponent component' onclick="ComponentClicked('4612', 'Don't know', '44761');">Don't know</span>
$('#accordion').html(htmlstring);
However, after the HTML for the element 'accordion' is set, upon inspecting the HTML of the div via FireBug (or other developer tool) the encoded apostrophe is lost and is instead replaced by an apostrophe which is un-encoded. The encoding seems to get lost in the .html method.
I've tried using assigning the HTML using the .innerHtml method instead, but the same thing happens.
Does anybody have any ideas as to why this is happening?