Return to Snippet

Revision: 27684
at June 21, 2010 03:38 by ekinertac


Initial Code
<script type="text/javascript">

function count(){
var ul = document.getElementById('ulid');
var i=0, c =0;
while(ul.getElementsByTagName('li')[i++]) c++;
alert(c);
}

</script>


<input type="button" onclick="count()";>
<ul id="ulid">
<li>list 1</li>
<li>list 2</li>
<li>list 3</li>
<li>list 4</li>
<li>list 5</li>
</ul>

Initial URL

                                

Initial Description

                                

Initial Title
Javascript count list items

Initial Tags
list

Initial Language
JavaScript