Menu Close

How To Filter Data Table Using Jquery With Html

Data table filter

Here, we will see how to filter data from html tables using Jquery functions. Follow the below example to create a data table filter.


Create a html file and add the below snippet to your file. This file contains html data tables and jquery script for filtering the data from the table.

<!DOCTYPE html>
    <title>How To Filter Data Table Using Jquery With Html</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
    <script src=""></script>
    <script src=""></script>
    <link rel="stylesheet" href="style.css">
    <div id="data_style">
        <span>Search by FirstName, LastName or Email</span>
        <input id="data_input" class="tbox"  type="text" placeholder="Search.." />
          <tbody id="tbody">
    $(document).ready(function () {
        $("#data_input").on("keyup", function () {
            var value = $(this).val().toLowerCase();
            $("#tbody tr").filter(function () {
                $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)


Create an external stylesheet and add the below css to your stylesheet. Then link it to your html file.

body {
    margin: 50px;
    font-family: Arial, sans-serif;
    padding: 10px;
    background: #fafafa;

table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;

td, th {
  border: 2px solid #333;
  text-align: left;
  padding: 10px;

tr:nth-child(even) {
  background-color: #d3ead7;

.tbox {
    width: 300px;
    height: 30px;
    background: #f1f1f1;
    border-radius: 3px;
Posted in HTML, jQuery

You can also read...