. I want to break them into javascript. How can i do this? (I know ...">

JavaScript pagination

I have html code inside of which is <div class="post">. I want to break them into javascript. How can i do this? (I know I can do it using PHP, but I just want to do it using JS)

The html generated by my php looks like this:

    <body>
<div id="content">
<div class="post">
post content
</div>
<div class="post">
</div>
...

</div>

</body>

Maybe it is better to use jquery for this? (I use jquery ajax to load html into allready content)

+3
source share
4 answers

There is a jquery plugin that works great https://github.com/gbirke/jquery_pagination

+1
source

. , 10, <div> . [1] [2] [3]... , <div>, , $("#ct").load("/posts?id=5");

+1

Yes, using jQuery to simulate pagination is a valid task. You can easily use the template jQuery(selector).hide().slice(start,end).show()to do what you want. Then you need to control the start and end of the code, but this should be easy enough.

0
source

All Articles