Apply Pagination To The Existing Table Using Datatable

 




Complete Example


<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Apply Pagination To The Existing Table Using Datatable</title>
    <link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
</head>

<body>
    <h1>Apply Pagination To The Existing Table Using Datatable</h1>
    <table id="usersTable">
        <thead>
            <tr>
                <th>#</th>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>1</td>
                <td>Habib</td>
            </tr>
            <tr>
                <td>2</td>
                <td>Metin</td>
            </tr>
        </tbody>
    </table>
    <script src="https://code.jquery.com/jquery-3.6.1.min.js"
        integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script>
    <script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
    <script>
        $(function () {
            $('#usersTable').DataTable();
        });
    </script>
</body>

</html>




See the Pen Untitled by Muhammad Habib (@mhabib555) on CodePen.

Comments

Popular posts from this blog

JS-QR Generator

Input Mask Using Libraries

PHP -Sending Email from Localhost (XAMPP) Using SendinBlue