Accessing child elements in jquery
<pre><code>&lt;div id="main"&gt;
 &lt;div id="1"&gt;
   &lt;div&gt;contents..&lt;/div&gt;
   &lt;div&gt;contents..&lt;/div&gt;
 &lt;/div&gt;
 &lt;div id="2"&gt;
   &lt;div&gt;contents..&lt;/div&gt;
   &lt;div&gt;contents..&lt;/div&gt;
 &lt;/div&gt;
 &lt;div id="3"&gt;
   &lt;div&gt;contents..&lt;/div&gt;
   &lt;div&gt;contents..&lt;/div&gt;
 &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>How can i access all <code>div object</code> into a single array who have <code>contents in there innerHTML</code>?</p>

<p><strong>EDIT</strong></p>

<p>OK I tried this :</p>

<pre><code>var totaldiv = $("#main").children();
var totalElements = [];
var c = 0;
$.each(totaldiv, function (i, v) {
    $(totaldiv[i]).children().each(function () {
        totalElements[c++] = $(this);
    });
});
</code></pre>

<p>Is there any more efficient way to do this?</p>
