Getting a text of Outer DIV using Jquery
<p>I have Outer DIVS like this.</p>

<pre><code>&lt;Input id ="SaveMe" value="Click" type="submit" &gt;
&lt;/Input&gt;

&lt;DIV id="DivOne"&gt;
    &lt;DIV &gt;First Content
        &lt;DIV&gt;X
        &lt;/DIV&gt;
    &lt;/DIV&gt;
        &lt;DIV&gt;Second Content
            &lt;DIV&gt;X
            &lt;/DIV&gt;
    &lt;/DIV&gt;

&lt;/DIV&gt;
</code></pre>

<p>I would like to loop through outer DIVs and get the text.I am using the JQuery Code.</p>

<pre><code>$("#SaveMe").click(function() {
    $("#DivOne").children().each(function(index, elem) {
        alert($(elem).text());
    });
});
</code></pre>

<p>But it shows First Content X ,Second Content X. I was hoping the "each loop" will loop through the outer DIV first and then the inner DIVs.How can i ignore looping through the inner DIVs (the DIVs with content X). <a href="http://jsfiddle.net/VVGRc/1/" rel="nofollow">http://jsfiddle.net/VVGRc/1/</a></p>

<p>Thanks !</p>
