Get all elements nested in UL tag
<p>I have HTML code structure:</p>

<pre><code>&lt;ul id="main"&gt;
 &lt;li&gt;   
    &lt;a href="#"&gt;&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;li&gt;
&lt;/ul&gt;
</code></pre>

<p>Want to select all elements inside UL id="main". </p>

<p>Tried to use:</p>

<pre><code>var el = document.getElementById("main").getElementsByTagName("*");


for (var i=0; i&lt;el.length; i++) {
    alert(el[i].tagName);
}
</code></pre>

<p>But only get LI and A tags. UL tags are missing. Any ideas ?</p>
