How to get only <li> tag's innnerHTML from the content having html code
<p>I am new to javascript. Can anyone provide idea how to get li tag innerHTML in array. for example:</p>

<pre><code>var content = '&lt;li&gt;Item 1&lt;/li&gt;
&lt;li&gt;Item 2
 &lt;ol&gt;
  &lt;li&gt;Item 3&lt;/li&gt;
  &lt;li&gt;Item 4&lt;/li&gt;
 &lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Item 5&lt;/li&gt;'
</code></pre>

<p>I want to iterate it such that i can get output as follows:</p>

<pre><code>arr[0]='&lt;li&gt;Item 1&lt;/li&gt;'
arr[1]='&lt;li&gt;Item 2
 &lt;ol&gt;
  &lt;li&gt;Item 3&lt;/li&gt;
  &lt;li&gt;Item 4&lt;/li&gt;
 &lt;/ol&gt;
&lt;/li&gt;'
arr[2]='&lt;li&gt;Item 5&lt;/li&gt;'
</code></pre>

<p>Moreover, Nested li can also be used similarly by iterating in nested ol.</p>

<p>I want to use something like <code>document.getElementsByTagName("li");</code> but it should use only content variable data. </p>

<p>Thanks.</p>
