Understanding pagination

Pagination is the act of collating large amounts of data and presenting it to the user in small, easy-to-read sections or pages.

With a combination of jQuery, JavaScript functions, and event handlers, we are able to easily collate and present data to the user in pages.

Getting ready

To create a paginated set of data, we first need some data to paginate and then a location to place the paginated data. Use the following code to create an HTML page:

<!DOCTYPE html> <html> <head> <title>Chapter 1 :: DOM Manipulation</title> <script src="jquery.min.js"></script> <script> var animals = [ { id: 1, name: 'Dog', type: 'Mammal' }, { id: 2, name: 'Cat', type: 'Mammal' }, { id: 3, name: 'Goat', type: 'Mammal' }, { id: 4, name: 'Lizard', ...

Get jQuery 2.0 Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.