I am using the following code:
<script>
$(document).ready(function() {
$(function() {
$("ul.items").each(function() {
$("li:gt(4)", this).hide();
});
});
});
</script>
Basically it’s not hidding anything…
Here is the list part of the code:
<ul class="items">
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
</ul>
Can anyone spot the problem?
Try this (a lot cleaner):
http://jsfiddle.net/NLDTF/