I have an xml file like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<legends>
<legend>
<number>1</number>
<legendString><ul><li>1.across:a system of rules of conduct or method of practice</li><li>1.down:a disagreement or argument about something important</li><li>2.down:any broad thin surface</li><li>3.across:the passage of pedestrians or vehicles </li></ul></legendString>
</legend>
......
<legends>
How can I take whole text including tags using jQuery. The string
<ul><li>1.across:a system of rules of conduct or method of practice</li><li>1.down:a disagreement or argument about something important</li><li>2.down:any broad thin surface</li><li>3.across:the passage of pedestrians or vehicles </li></ul>
should be passed if I make a function call. If I call:
var legendStr = $(this).find("legendString").text();
tags will not be present in legendStr.
How can I proceed.
This is the jQuery Script:
var randomnumber=Math.floor(Math.random()*233);
$.get("legends.xml",{},function(xml){
$(xml).find("legend").each(function(){
if(randomnumber == $(this).find("number").text())
{
var c = "legendString";
var legendStr = $(this).find(c).html();
$("#sidebar > ul").html(legendStr);
}
});
},"xml");