I have an xml file with html tags in it that I parse using jquery ajax. I can get the text value without a problem. How do I get the html part within an element?
Edit: I tried wrapping the html in cdata but would rather have the xhtml within the xml.
$.ajax({ type: "GET",
url: "product.xml",
dataType: "xml",
success: function (xml) {
$(xml).find("product[productid=" + selection + "]").each(function () {
var $title = $(this).find("title").text(); //get title
var $desc = $(this).find("description").html(); //get description
//$('[nodeName=]',xml)
$("#producttitle").html("");
$("#productdesc").append($desc);
$("#producttitle").append($title);
});
}
<product productid="1">
<title>Active Directory</title>
<status>noinfo</status>
<description>
Headline
<b>tester</b>
<ul>
<li>test list element</li>
</ul>
</description>
<link title=""></link>
</product>
Cheers, Terry