Whilst many cool Javascript pagination packages out there, a lot of times what you might want is a simple function to handle pagination of certain items on a page. In such situations, installing a separate package to handle a simple pagination task might be overkill especially if you are particular and concerned about the portability and speed of execution of your code. In my opinion, installing a separate package to handle pagination of 200 items or less is definitely an overkill.
This guide is to help you understand the concept of pagination and how to implement a simple re-useable Javascript function that can be used to handle pagination of items of minimal sizes before being rendered on a page or returned as a response in an API request.
I will try to explain how you can easily build a simple pagination feature in a step-by-step approach for an easy understanding of the main logic.
At the bottom of this page is a jsFiddle live demo of this concept, feel free to skip all the explanations and move straight to the live demo if you can understand the code by yourself.