css - Restricting certain elements from being printed -


i trying print elements javascript. example, when link clicked open print dialog window. however, wish have elements of table not printed , headers on 1 line instead of breaking multiple lines.

printing elements

i want rid of edit , delete table cells , put table headers on 1 line. here current javascript code have in place:

$('#print').on('click', function() {     var content = document.getelementbyid("sample_editable_2");     var holderwindow = window.open("");      holderwindow.document.write(content.outerhtml);     holderwindow.print();     holderwindow.close(); }); 

sorry if unclear, i've never attempted before.

appreciate can given.

  • edit:

here css file

 @media print {     .h_edit {         display: none;     }      .h_delete {         display: none;     }      .b_edit {         display: none;     }      .b_delete {         display: none;     }      .order-issue {         white-space: nowrap;     }      .sub-shipping-issue {         white-space: nowrap;     }      .sub-refunds-returns-issue {         white-space: nowrap;     }      .sub-update-issues {         white-space: nowrap;     }      .sub-campaign-issues {         white-space: nowrap;     }      .sub-campaign-change-issues {         white-space: nowrap;     }      .sub-campaign-design-issues {         white-space: nowrap;     }      .sub-teeforall-works {         white-space: nowrap;     }      .order-id {         white-space: nowrap;     }      .site-url {         white-space: nowrap;     } } 

and calling css file so: <link rel="stylesheet" media="print" type="text/css" href="/css/print.css">

but still not hiding elements , making them not wrap.

i don't understand how related javascript. control how pages printed, need write css file print only. like

<link rel="stylesheet" type="text/css" media="print" href="print.css" />

then in print.css should do

.print-hide {    display: none; // or whatever want } 

any item .print-hide treated above css.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -