This is probably a silly question but I googled for hours with no luck..I have some ul li like this:
<li><a href="#" class="pa">..</a></li>
<li><a href="#" class="pa">..</a></li>
<li><a href="#" class="pa">..</a></li>
<li><a href="#" class="pa">..</a></li>
<li><a href="#" class="pa">..</a></li>
How do I show only a specific set of li? So only 1 to 3 or 1 to 4 and hide the others? I would like doing this according to a var like:
var number_of_list = 5; {
if (some_results > 5)
{
...'show 5 ul li with jquery'...
}
If that is not possible Then I would like doing this wit an event like:
$(input).keyup(function() {
number_of_list = 5;
$(ul li)....show 5 ul li...(which is number_of_list of course) ;
});
In jQuery you can do something like this:
this will start by hiding all
lielements then show the first 4 – you can just change the number to show the first #To use a variable, do this: