Loop through all list items under an ordered or unordered list

Suppose you have the following HTML Code and you want to loop through each <li> tag under the top <ul> or <ol> tag:

<ul id="idOfTheListTag">
<li><ul>
<li><input checked="1" type="checkbox" /></li>
<li>A1</li>
<li>B1</li>
<li>C1</li>
<li>D1</li>
</ul>
</li>
<li><ul>
<li><input checked="1" type="checkbox" /></li>
<li>A2</li>
<li>B2</li>
<li>C2</li>
<li>D2</li>
</ul>
</li>
<li><ul id="menu">
<li><input checked="1" type="checkbox" /></li>
<li>A3</li>
<li>B3</li>
<li>C3</li>
<li>D3</li>
</ul>
</li>
</ul>

To loop through all the <li> tags below is the javascript function:

Make Money from Surveys

Popular posts from this blog

The current master key cannot be decrypted

Schema.Object has an unresolved reference to Schema

Remove dateModified related warning appearing during Structured data testing