I have this code, which works:
$('.invest-port-thumb a').mouseenter(function() {
$('#slider-name').load(this.href + ' cName');
});
Loading this XML:
<fragment>
<cName cind="Industrial" stat="Active">ABC Company</cName>
<hq>Chicago, IL</hq>
</fragment>
How should I modify this code to load the cind attribute of cName?
jQuery will not automatically parse the XML for you on load. But, you can use jQuery to parse the XML. Check out this page for examples: http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html. Basically, you load the XML and perform your selections and modifications like this:
Here’s a demo to get you started: if you only have one fragment and one cName in your XML, it’s safe to do this:
It appears that you are using load() to load a fragment of the XML. Instead, try loading the entire XML content to a variable, and parse the cind attribute out of it using the line of code I gave you above.
EDIT:
Try this: