Sui Go Sui Go - 6 months ago 25
HTML Question

How can I make my unordered list to paging using jquery?

I want to know how can I make my

<ul>
to paging?

Example: prev 1 2 3 4 5 next

when I click next it will go like this

prev 2 3 4 5 6 next

when I click prev it will go like this

prev 1 2 3 4 5 next

and so on...

<ul class="pages">
<li>Prev</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>Next</li>
</ul>

Answer

You could also use :gt(n)//n denotes number

$(function (){
     $("li:gt(5)").css("display", "none");
        });​

JsFiddle Demo

If you want to see from 6 to 10 element then you can

$(function (){
     $("li:lt(6)").css("display", "none");
        });​