Datatable JQuery Print Specific Elements

How to print specific elements from outside the datatable?

Here is an example JSFIDDLE

I wanted that when I pressed the PRINT button, this div below is printed also

<div id="PRINT_HERE_TOO" class="test">
   <h1>
      Print Here Too!
   </h1>
</div>

Am I clear? Thank you!

Author: Jackson, 2017-11-06

1 answers

I think this is what you want:

Https://jsfiddle.net/ms85e7zo/3 /

$(document).ready(function() {
    $('#example').DataTable( {
          dom: 'Bfrtip',
        buttons: [
            {
                extend: 'print',
                messageTop: $("#PRINT_HERE_TOO").html()
               }
        ]
    } );
 1
Author: sir_ask, 2017-11-06 16:22:58