We would like to know how to control menu css based on child item count.
<!--from www. jav a 2 s. co m-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.4.2.js'></script>
<script type='text/javascript'>
$(window).load(function(){
$('#menu > li > a').not(':only-child').css('color', 'red');
});
</script>
</head>
<body>
<ul id="menu">
<li><a href="#">Home</a></li>
<li><a href="#">Manage Customer</a>
<ul>
<li><a href="#">Customer List</a></li>
<li><a href="#">Customer Detail</a></li>
</ul></li>
</ul>
</body>
</html>
The code above is rendered as follows: