0

Here i created

After appending inline html table data to html table, open to new tab and show print view

but the problem was appending data is not shows.

There only show html page table data

test.html

<div>
    <p>Your content here</p>
    <table  id="toPrint">
        <tr>
            <th>Name</th>
            <th>Phone</th>
        </tr>
    </table>
</div> 

print button in another html page and onclick by using backbone.js

print : function() {
    var htmlTable2 = '<tr class="header">'
        + '<td>Prasanth</td>' + '<td>12345678</td>'
        + '</tr>';
    var html1 = $("#toPrint tbody").append(htmlTable2);
    window.open("test.html").print();
},

how this change to html page table + append inline html data to open a new tab and show print option.

JoriO
  • 1,050
  • 6
  • 13
Prasanth A R
  • 4,046
  • 9
  • 48
  • 76

1 Answers1

0

instead of window.open("test.html").print(); do window.print();

By opening your page again, you lose the changes.

ngstschr
  • 2,119
  • 2
  • 22
  • 38