Question : jQuery: Count items in list

Using jQuery, how can I find the number of list items in #myList?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 
</head>
<body>

<ul id="myList">
 <li>Item A</li>
 <li>Item B</li>
 <li>Item C</li>
</ul>

<script type="text/javascript">
/*<![CDATA[*/

alert('There are ? Items in the list #myList');

/*]]>*/
</script>

</body>
</html>

Answer : jQuery: Count items in list

work too : $("li","#myList").length
Random Solutions  
 
programming4us programming4us