> I'm trying to convert an xml node into an object...all I want to do is > find the name of the tag...function > > function initObjArray(xml, arr, tagName){ > (xml).find(tagName).each(function(){ > > var o = new Object(); > var t = $(this); > var c = t.children(); > c.each( function(){ > > var key = $(this).TAGNAME; > var val = $(this).text();
You don't need to extract the tagname from the element. It was passed into your function and is the bases of your "find" operation. Just use tagName, or var key = tagName;