I have this simple xml\[code\]<?xml version="1.0"?><library> <item name="box_shelf"> <imageback src="http://stackoverflow.com/questions/13824935/images/box_shelf_color.png"/> <outline src="http://stackoverflow.com/questions/13824935/images/box_shelf_outline.png"/> <sku> <wh sku="4696424171" /> <ch sku="4696424179" /> <choc sku="4696425863" /> <ma sku="4696424175" /> </sku> </item></library>\[/code\]Loading the xml is fine. I then have a function to parse certain nodes.\[code\]function parseImageXml(mainNode,targetNode) { $(libraryXML).find('item').each(function() { if($(this).attr('name') == mainNode) { var $temp = $(this).find(targetNode).attr('src'); console.log("******"+$temp); return $temp; } });}\[/code\]The console log is fine with\[code\]******images/box_shelf_outline.png******images/box_shelf_color.png\[/code\]But when I try to return the value into variables, I get undefined.\[code\]var image_outline = parseImageXml("box_shelf","outline");var image_back = parseImageXml("box_shelf","imageback");console.log(image_outline+":"+image_back);undefined:undefined\[/code\]Any insight would be great, thanks