0

mytable.php

<table id="tableid">
    <thead>
        <tr>
            <th scope="col">A</th>
            <th scope="col">B</th>  
            <th scope="col">C</th> 
            <th scope="col">D</th>
        </tr>
    </thead>
    <tbody>
      <tr>
    <td>0</td>
    <td>2</td>
    <td>3</td>
    <td>4</td>
</tr>
<tr>
    <td>5</td>
    <td>6</td>
    <td>7</td>
    <td>8</td>
</tr>
<tr>
    <td>9</td>
    <td>10</td>
    <td>11</td>
    <td>12</td>
</tr>
</tbody>
</table>

Hello Guys, Can anyone help me how to convert my code to the Datatables? Sorry Guys for this question I try to convert but it didn't work. I'm a beginner and still learning how to use tables

7
  • Do you mean the jQuery DataTables? Commented May 15, 2020 at 10:46
  • yes sir........ Commented May 15, 2020 at 10:47
  • $(document).ready( function () { $('#tableid').DataTable(); } ); didn't work? What have you done so far? Commented May 15, 2020 at 10:49
  • yes, sir, I try this in my code but it didn't work Commented May 15, 2020 at 10:53
  • <link rel="stylesheet" type="text/css" href="cdn.datatables.net/1.10.21/css/jquery.dataTables.css"> <script type="text/javascript" charset="utf8" src="cdn.datatables.net/1.10.21/js/…> Commented May 15, 2020 at 10:53

1 Answer 1

1

Script

$(document).ready(function() {
    $('#example').DataTable();
} );

HTML

<table id="example" class="display" style="width:100%">

 <tr>
......
</tr>
</table>

In addition to the above code, the following Javascript library files are loaded for use in this example:

https://code.jquery.com/jquery-3.5.1.js

https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.