JSFiddle - React, Tailwind, and code Playground

by pratapamit

HTML

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css">
<script src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.html5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>



<table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Sr. No</th>
                <th>id</th>
                <th>Name</th>
                <th>Phone Number</th>
                <th>Photo</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>Sr. No</th>
                <th>id</th>
                <th>Name</th>
                <th>Phone Number</th>
                <th>Photo</th>
            </tr>
        </tfoot>
        <tbody>
            <tr>
              <td>1</td>
              <td>s12</td>
              <td>John</td>
              <td>9876543210</td>
              <td><img src="https://via.placeholder.com/100/09f/fff.png"></td>
             </tr>
            <tr>
              <td>2</td>
              <td>s15</td>
              <td>John 2</td>
              <td>9876543211</td>
              <td><img src="https://via.placeholder.com/100/09f/fff.png"></td>
             </tr>
        </tbody>
    </table>

JavaScript

$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            {
              extend: 'pdf',
              title: 'Result for pdf'
            }, 
            {
              extend: 'print',
              title: 'Result for Print'
            },
        ]
    } );
} );