{"id":6292,"date":"2024-01-11T16:40:00","date_gmt":"2024-01-11T16:40:00","guid":{"rendered":"https:\/\/codehim.com\/?p=6292"},"modified":"2024-01-22T14:43:45","modified_gmt":"2024-01-22T09:43:45","slug":"javascript-table-pagination-with-search","status":"publish","type":"post","link":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/","title":{"rendered":"JavaScript Table Pagination with Search"},"content":{"rendered":"<p>This JavaScript code snippet helps you to create table pagination with a search box. Basically, it arranges data in a table look-like unordered list. It appends a search box and pagination with that list to <a href=\"https:\/\/codehim.com\/text-input\/javascript-search-box-for-table\/\" target=\"_blank\" rel=\"noopener\">filter and navigate table data<\/a>.<\/p>\n<h2>How to Create Table Pagination with Search<\/h2>\n<p>1. First of all, create the HTML structure as follows:<\/p>\n<pre class=\"prettyprint linenums lang-html\"> &lt;div class=\"page\"&gt;\r\n      &lt;div class=\"page-header cf\"&gt;\r\n        &lt;h2&gt;Students&lt;\/h2&gt;\r\n      &lt;\/div&gt;\r\n      &lt;ul class=\"student-list\"&gt;\r\n        &lt;li class=\"student-item cf\"&gt;\r\n            &lt;div class=\"student-details\"&gt;\r\n                &lt;img class=\"avatar\" src=\"https:\/\/randomuser.me\/api\/portraits\/thumb\/women\/67.jpg\"&gt;\r\n                &lt;h3&gt;iboya vat&lt;\/h3&gt;\r\n                &lt;span class=\"email\"&gt;iboya.vat@example.com&lt;\/span&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"joined-details\"&gt;\r\n                   &lt;span class=\"date\"&gt;Joined 07\/15\/15&lt;\/span&gt;\r\n           &lt;\/div&gt;\r\n        &lt;\/li&gt;\r\n       .\r\n       .\r\n       .\r\n        &lt;li class=\"student-item cf\"&gt;\r\n            &lt;div class=\"student-details\"&gt;\r\n                &lt;img class=\"avatar\" src=\"https:\/\/randomuser.me\/api\/portraits\/thumb\/men\/89.jpg\"&gt;\r\n                &lt;h3&gt;henri kruse&lt;\/h3&gt;\r\n                &lt;span class=\"email\"&gt;henri.kruse@example.com&lt;\/span&gt;\r\n            &lt;\/div&gt;\r\n            &lt;div class=\"joined-details\"&gt;\r\n                   &lt;span class=\"date\"&gt;Joined 05\/14\/13&lt;\/span&gt;\r\n           &lt;\/div&gt;\r\n        &lt;\/li&gt;\r\n      &lt;\/ul&gt;\r\n    &lt;\/div&gt;\r\n<\/pre>\n<p>2. After that, style the basic page layout and table element using the following CSS code.<\/p>\n<pre class=\"prettyprint linenums lang-css\">.page{\r\n  margin: 50px auto;\r\n  width: 70%;\r\n  background-color: #fff;\r\n  border-radius: 5px;\r\n  padding: 50px;\r\n}\r\n\r\n.page-header{\r\n  margin-bottom: 20px;\r\n}\r\n  .page-header h2{\r\n    float: left;\r\n    font-size: 22px;\r\n    text-transform: uppercase;\r\n    font-weight: bold;\r\n    color: #555;\r\n  }\r\n\r\n  .page-header .student-search{\r\n    float: right;\r\n  }\r\n\r\n    .page-header .student-search input{\r\n      border-radius: 5px;\r\n      border: 1px solid #eaeaea;\r\n      padding: 8px 15px;\r\n      font-size: 14px;\r\n    }\r\n\r\n    .page-header .student-search button{\r\n      border-radius: 5px;\r\n      border: 1px solid #eaeaea;\r\n      padding: 8px 15px;\r\n      font-size: 14px;\r\n      background-color: #4ba6c3;\r\n      color: #fff\r\n    }\r\n\r\n.student-list{}\r\n\r\n  .student-item{\r\n    margin: 0 0 20px 0;\r\n    padding: 0 0 20px 0;\r\n    border-bottom: 1px solid #eaeaea;\r\n  }\r\n\r\n    .student-details{\r\n      width: 50%;\r\n      float: left;\r\n    }\r\n\r\n      .student-details .avatar{\r\n        width: 40px;\r\n        height: auto;\r\n        border-radius: 20px;\r\n        float: left;\r\n        margin-right: 14px\r\n      }\r\n\r\n      .student-details h3{\r\n        margin: 4px 0 2px 0;\r\n        font-weight: bold;\r\n        color: #4ba6c3;\r\n      }\r\n\r\n      .student-details .email{\r\n        color: #888;\r\n        font-size: 14px;\r\n      }\r\n\r\n\r\n    .joined-details{\r\n      width: 50%;\r\n      float: left;\r\n      text-align: right;\r\n    }\r\n\r\n      .joined-details .date{\r\n        margin-top: 15px;\r\n        display: block;\r\n        font-size: 14px;\r\n        color: #999;\r\n      }\r\n\r\n  .student-item:last-child{\r\n    margin: 0;\r\n    padding: 0;\r\n    border-bottom: none;\r\n  }\r\n\r\n.pagination{\r\n  margin: 40px 0 0 0;\r\n  text-align: center;\r\n}\r\n \r\n  .pagination li{\r\n    display: inline;\r\n  }\r\n\r\n    .pagination li a{\r\n      border: 1px solid #eaeaea;\r\n      border-radius: 5px;\r\n      padding: 3px 8px;\r\n      text-decoration: none;\r\n      color: #4ba6c3;\r\n    }\r\n\r\n    .pagination li a.active,\r\n    .pagination li a:hover{\r\n      background-color: #4ba6c3;\r\n      color: #fff;\r\n    }\r\n\/* https:\/\/meyerweb.com\/eric\/tools\/css\/reset\/ \r\n   v2.0 | 20110126\r\n   License: none (public domain)\r\n*\/\r\n\r\nhtml, body, div, span, applet, object, iframe,\r\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\r\na, abbr, acronym, address, big, cite, code,\r\ndel, dfn, em, img, ins, kbd, q, s, samp,\r\nsmall, strike, strong, sub, sup, tt, var,\r\nb, u, i, center,\r\ndl, dt, dd, ol, ul, li,\r\nfieldset, form, label, legend,\r\ntable, caption, tbody, tfoot, thead, tr, th, td,\r\narticle, aside, canvas, details, embed, \r\nfigure, figcaption, footer, header, hgroup, \r\nmenu, nav, output, ruby, section, summary,\r\ntime, mark, audio, video {\r\n  margin: 0;\r\n  padding: 0;\r\n  border: 0;\r\n  font-size: 100%;\r\n  font: inherit;\r\n  vertical-align: baseline;\r\n}\r\n\/* HTML5 display-role reset for older browsers *\/\r\narticle, aside, details, figcaption, figure, \r\nfooter, header, hgroup, menu, nav, section {\r\n  display: block;\r\n}\r\nbody {\r\n  line-height: 1;\r\n}\r\nol, ul {\r\n  list-style: none;\r\n}\r\nblockquote, q {\r\n  quotes: none;\r\n}\r\nblockquote:before, blockquote:after,\r\nq:before, q:after {\r\n  content: '';\r\n  content: none;\r\n}\r\ntable {\r\n  border-collapse: collapse;\r\n  border-spacing: 0;\r\n}\r\n\r\n.cf:after { \r\n   content: \".\"; \r\n   visibility: hidden; \r\n   display: block; \r\n   height: 0; \r\n   clear: both;\r\n}\r\n\r\n.navlink {\r\n  float: left;\r\n}\r\n<\/pre>\n<p>3. Finally, add the following JavaScript code to your project to functionalize the table search and pagination.<\/p>\n<pre class=\"prettyprint linenums lang-js\">\/\/get all the main elements on the page\r\nvar page = document.querySelector(\".page\");\r\nvar pageHeader = document.querySelector(\".page-header\");\r\nvar studentList = document.querySelector(\".student-list\");\r\nvar eachStudent = document.querySelectorAll(\".student-item\");\r\nvar studentDetails = document.querySelector(\".student-details\");\r\nvar inputString = document.getElementById('inputSearch');\r\n\r\n\/\/Set the pages variable\r\nvar currentPage = 1;\r\nvar numPages = 0;\r\nvar studentsPerPage = 10;\r\nvar index;\r\n\r\n\/\/Recreate Search Element in Js\r\nvar searchBar = function createBar (searchString) {\r\n\t\/\/Creating the three elements that make up the search bar\r\n\tvar studentSearch = document.createElement(\"div\");\r\n\tvar input = document.createElement(\"input\");\r\n\tvar searchButton = document.createElement(\"button\");\r\n\tvar txtNode = document.createTextNode(\"Search\");\r\n\t\/\/Define the type of the entry\r\n\tinput.type=\"text\";\r\n\t\/\/Set the attributes fro the different elements to make it easier to select them\r\n\tstudentSearch.setAttribute(\"class\", \"student-search\");\r\n\tinput.setAttribute(\"id\", \"inputSearch\");\r\n\tsearchButton.setAttribute(\"id\", \"search-button\");\r\n\t\/\/Append all these elements to the page\r\n\tsearchButton.appendChild(txtNode);\r\n\tstudentSearch.appendChild(input);\r\n\tstudentSearch.appendChild(searchButton);\r\n\t\/\/Setting the placeholder for the searchButton\r\n\tinput.placeholder = \"Type name here..\";\r\n\r\n\t\/\/Return the main element which contains all the elements\r\n\treturn studentSearch;\r\n}\r\n\r\n\/\/Create static container for pagination in Js\r\nvar paginationFilter = function pageFilter (nbOfEntries) {\r\n\t\/\/Create the static elements for the pagination \r\n\tvar pagination = document.createElement('div');\r\n\tvar ulList = document.createElement('ul');\r\n\t\/\/Giving them attributes to select them easily\t\r\n\tpagination.setAttribute(\"class\", \"pagination\");\r\n\tulList.setAttribute(\"id\", \"pagelist\");\r\n\t\/\/Append the ulList to the main pagination div\r\n\tpagination.appendChild(ulList);\r\n\t\/\/Return the main div that contains all the elements\r\n\treturn pagination;\t\r\n};\r\n\r\n\/\/Finding the number of students\r\nvar numberOfStudents = function () {\r\n\tvar numberOfStudents = eachStudent.length;\r\n\t\/\/Return the number of students\r\n\treturn (numberOfStudents);\r\n}\r\n\r\n\/\/Finding the number of pages\r\nvar numberOfPages = function () {\r\n\t\/\/Divise the number of students by the number of students per pag\r\n\tvar numberOfPages = parseInt(numberOfStudents() \/ studentsPerPage);\r\n\t\/\/If there is a remaining to the above division then create an extra page\r\n\tif ( numberOfStudents() % studentsPerPage &gt; 0 ){\r\n\t\tnumPages += 1;\r\n\t}\r\n\t\/\/Return the number of students\r\n\treturn numberOfPages;\r\n};\r\n\r\n\/\/Start by hiding all the students on the list\r\nvar hideAll = function () {\r\n\tfor (var i = 0; i &lt; numberOfStudents(); i++) {\r\n\t\teachStudent[i].style.display = \"none\";\r\n\t}\r\n};\r\n\r\n\/\/Then display only 10 intems per page\r\nfunction showStudents (number) {\r\n\tfor (var i = 0; i &lt; studentsPerPage; i++) {\r\n\t\tindex = number * studentsPerPage - studentsPerPage + i;\r\n\t\teachStudent[index].style.display = \"block\";\r\n    }\r\n};\r\n\r\n\/\/Create the pagination links dynamically\r\nfunction createPages () {\r\n\r\n\tfor (var i = 0; i &lt;= numberOfPages(); i++) {\r\n\t\t\/\/Create the dynamic elements in the pagination\r\n\t\tvar liList = document.createElement('li');\r\n\t\tvar pageLink = document.createElement('a');\r\n\t\t\/\/Set attributes to the pagination links &amp; the li list \r\n\t\tpageLink.setAttribute(\"href\", \"#\");\r\n\t\tpageLink.setAttribute(\"class\", \"link\");\r\n\t\tliList.setAttribute(\"class\", \"pageLi\");\r\n\t\t\/\/Append the different elements to the static ulList\r\n\t\tvar pagelist = document.getElementById(\"pagelist\");\r\n\t\tpagelist.appendChild(liList);\r\n\t\tliList.appendChild(pageLink);\r\n\t\t\/\/Create and appending the page numbers for the pagination\r\n\t\tvar pageNumbers = document.createTextNode(i + 1);\r\n\t\tpageLink.appendChild(pageNumbers);\r\n\r\n\t\tpageLink.addEventListener(\"click\", function(){\r\n\t   \t\tvar pageNumClicked = (this.innerHTML || this.innerText);\r\n\t   \t\tchangePage(pageNumClicked);\r\n\t\t}, false);\r\n\t}\r\n\treturn i;\r\n};\r\n\r\n\/\/Create the seach feature\r\nvar searchFunction = function searchFeature(searchString) {\r\n\tvar eachStudentI;\r\n\tconsole.log(\"Is my search feature working?\");\r\n\t\/\/Get the value entered in the search box\r\n\tvar inputString = document.getElementById('inputSearch');\r\n\t\/\/Onkeyup we want to filter the content by the string entered in the search box dynamically\r\n\tinputString.onkeyup = function() {\r\n\t\t\t\/\/toUpperCase to make it case insensitive\r\n\t\t\tvar filter = inputString.value.toUpperCase();\r\n\t\t\/\/loop through all the li's \r\n\t\tfor (var i = 0; i &lt; eachStudent.length; i++) {\r\n\t\t\t\/\/Select the student name and retrieve the .innerText value\r\n\t\t\tvar studentName = document.getElementsByTagName(\"h3\");\r\n\t\t\tvar studentInfo = studentName[i].innerText;\r\n\t\t\t\r\n\t\t\t\/\/Display all the results where indexOf() does not return -1\r\n\t\t\tif (studentInfo.toUpperCase().indexOf(filter) != -1)  {\r\n\t\t\t\teachStudent[i].style.display = 'list-item';\r\n\t\t\t\t\/\/numberOfStudents = eachStudent[i]\r\n\t\t\t\tconsole.log(eachStudent);\r\n\t\t\t\t} else {\r\n\t\t\t\teachStudent[i].style.display = 'none';\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\n\/\/Global function to add all the elements onLoad of the page\r\nfunction addElements() {\r\n\r\n\tpageHeader.appendChild(searchBar());\r\n\tpage.appendChild(paginationFilter());\r\n\r\n\tvar searchButton = document.getElementById(\"search-button\");\r\n\tsearchButton.addEventListener(\"click\", searchFunction);\r\n\t\/\/fadeIn();\r\n\t\/\/noResults();\r\n\thideAll()\r\n\tcreatePages();\r\n\tshowStudents(1);\r\n\tsearchFunction();\r\n}\r\nwindow.onload = addElements();\r\n<\/pre>\n<p>That&#8217;s all! hopefully, you have successfully integrated this JavaScript table search plugin. If you have any questions or facing any issues, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code snippet helps you to create table pagination with a search box. Basically, it arranges data in a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6296,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[116],"tags":[],"class_list":["post-6292","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-vanilla-javascript"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JavaScript Table Pagination with Search &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Table Pagination with Search &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-11T16:40:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T09:43:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"959\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"JavaScript Table Pagination with Search\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\"},\"wordCount\":119,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png\",\"articleSection\":[\"Vanilla JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\",\"url\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\",\"name\":\"JavaScript Table Pagination with Search &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:45+00:00\",\"description\":\"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png\",\"width\":1280,\"height\":959,\"caption\":\"JavaScript Table Pagination with Search\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vanilla JavaScript\",\"item\":\"https:\/\/codehim.com\/category\/vanilla-javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript Table Pagination with Search\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JavaScript Table Pagination with Search &#8212; CodeHim","description":"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Table Pagination with Search &#8212; CodeHim","og_description":"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.","og_url":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-11T16:40:00+00:00","article_modified_time":"2024-01-22T09:43:45+00:00","og_image":[{"width":1280,"height":959,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"JavaScript Table Pagination with Search","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:45+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/"},"wordCount":119,"commentCount":1,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png","articleSection":["Vanilla JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/","url":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/","name":"JavaScript Table Pagination with Search &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:45+00:00","description":"Here is a JavaScript code snippet to create table pagination with search box. You can view demo and download code.","breadcrumb":{"@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/javascript-table-pagination-with-search.png","width":1280,"height":959,"caption":"JavaScript Table Pagination with Search"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/vanilla-javascript\/javascript-table-pagination-with-search\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Vanilla JavaScript","item":"https:\/\/codehim.com\/category\/vanilla-javascript\/"},{"@type":"ListItem","position":3,"name":"JavaScript Table Pagination with Search"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":12115,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=6292"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6292\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/6296"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=6292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=6292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=6292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}