DataTables - Buttons - Print

HTML

<link rel="stylesheet" href="https://cdn.datatables.net/r/dt/dt-1.10.9,b-1.0.3,b-print-1.0.3/datatables.min.css">
<script src="https://cdn.datatables.net/r/dt/dt-1.10.9,b-1.0.3,b-print-1.0.3/datatables.min.js"></script>
<h3>jQuery DataTables: Remove footer</h3>
<a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a><hr>

<table id="example" class="table display" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
        </tr>
    </tfoot>
    <tbody>
        <tr>
            <td>Tiger Nixon</td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>61</td>
            <td>2011/04/25</td>
            <td>$320,800</td>
        </tr>
    </tbody>
</table>


<hr>
<a href="https://www.gyrocode.com/articles/tag/jquery-datatables/">See more articles about jQuery DataTables</a> on <a href="https://www.gyrocode.com/articles/">Gyrocode.com</a>

JavaScript

$(document).ready(function (){
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
           {
               extend: 'print',
               footer: false,
               exportOptions: {
                   stripHtml: false
               },
               attr: {
               		id: "test"
               }
           }        
        ]      
    } );    
});