Use parent node not children - jQuery .each(function())
<p>I am using jQuery to grab results from a webservice(3rd party can't change).  A result set is something like:</p>

<pre><code>&lt;result&gt; 
 &lt;contactId&gt;1234&lt;/contactId&gt; 
 &lt;contactState&gt;9&lt;/contactState&gt; 
 &lt;contactStateSortOrder&gt;5&lt;/contactStateSortOrder&gt;
  &lt;address&gt;
    &lt;addressId&gt;568&lt;/addressId&gt; 
    &lt;contactId&gt;9801&lt;/contactId&gt; 
  &lt;/address&gt;
&lt;/result&gt;
</code></pre>

<p>Now I am using</p>

<pre><code>$('result', xml).each(function() {
   $("contactId", this).text();
  });
</code></pre>

<p>to get the contact id out and doing what i need to do however the end result is 
12349801 all i would like is the 1234. Any ideas?</p>

<p>Thanks in advvace</p>
