I will doubt that the content is not in HTML format. The problem is that your content's response that is returned is in encoded format. That is why the problem occurs. The content is written directly as string. Because, (IMO) < and/or > are encoded as
<
and
>
. Thus when the browser gets the values, it considers them as string (not HTML) but when it renders them. It turns them in their actual representation rather than this encoded representation.
As a proof to my claim (because I don't have the source code to your application) I have created a fiddle for you. In that fiddle I have used two types of codes, and they do the same thing what you have referenced.
$('#decode').click(function () {
$('#paragraph').append('<input type="text" />');
});
$('#encode').click(function () {
$('#paragraph').append('<input type="text" />');
});
This code was exected over this HTML
<p id="paragraph"></p>
<button id="decode">HTML content</button>
<button id="encode">HTML encoded HTML</button>
The result was same, in case of decoded click, there was a new input element, but in other case there was a plain-text string being rendered on the screen. As a live example:
http://jsfiddle.net/afzaal_ahmad_zeeshan/w7rf2mc8/[
^]
I hope you get the point. If that is ASP.NET, you may consider using the
Html.Raw()
while rendering the content because it converts such encoded strings to HTML entities and brackets.