find xml node using jquery
Hi,
I have an asp .net image map loaded from xml, I am using jQuery to highlight the map.
At the same time I want to look up some descriptive text held in the xml. So far I have this.
Code:
$.ajax({
type: "GET",
url: "/xml/" + feed,
dataType: "xml",
success: function(xml) {
$(xml).find('area').each(function() {
var Helptext = $(this).find('helptext').text();
$('#ctl00_ContentPlaceHolder1_desc').html("<p class='helpHeader'>" + DB + "</p><p>" + Helptext.toString() + "</p>");
});
}
});
And my xml looks like this
Code:
<area>
<componentDrillDown>N</componentDrillDown>
<component>NA</component>
<shape>poly</shape>
<helptext>to do</helptext>
<title>Light</title>
<coords>343, 25, 366, 15, 390, 13, 408, 15, 416, 19, 420, 22, 410, 32, 395, 40, 377, 40, 361, 38, 351, 33</coords>
</area>
At the minute this just gets the last helptext node in the file, how would I find the helptext based on the sibling node title's text?
Re: find xml node using jquery
Hello,
You should be able to do something like this:
Code:
$(xml).find("area helptext:contains('to do')")
See here:
http://www.ibm.com/developerworks/xm...x.html?ca=drs-
For more information.
Gary