I have an XML file which has four <resutGroups> tag:
<resultGroups>
<subGroups>
<name> </name>
</subGroups>
<name> </name>
</resultGroups>
each <resultGroup> has several <subGroups> and each <subGroups> has <name> tag.
I want to select only the name tag of <resultGroups> only
$(xml).find("resultGroups").each(function() {
alert( $(this).find("name").text() );
}
When I use the above code it returns all the names inside the <resultgroups> and <subGroups>.
How can I select only one <name> which is in the <resultGroups> tag?