function pageselectCallback(page_index, jq){ // Get number of elements per pagination page from form var items_per_page = 10; var articles = $('#nonPagedArticles div.pdf-reports') var max_elem = Math.min((page_index+1) * items_per_page, articles.length); var newcontent = ''; var firstItem = ' first'; // Iterate through a selection of the content and build an HTML string for(var i=page_index*items_per_page;i' + articles[i].innerHTML + ''; firstItem = ''; } // Replace old content with new content $('#pagedArticles').html(newcontent); // Prevent click eventpropagation return false; } function initPagination() { var num_entries = $('#nonPagedArticles div.pdf-reports').length; // Create pagination element $("#pagination").pagination(num_entries, { num_edge_entries: 2, num_display_entries: 8, callback: pageselectCallback, items_per_page: 10 }); } // When the HTML has loaded, call initPagination to paginate the elements $(document).ready(function(){ initPagination(); document.getElementById('nonPagedArticles').style.display = 'none'; });