0

I am trying to print just the contents of a colorbox

$(".print-invoice").on("click", function(event){
    window.print();
  return false;
});

This prints the whole page, the file path is popups/info.html

LeBlaireau
  • 17,133
  • 33
  • 112
  • 192
  • Possible duplicate [Print
    only?](http://stackoverflow.com/questions/468881/print-div-id-printarea-div-only)
    – arun Apr 30 '12 at 10:34
  • @N0nh4x0rツ not sure how you thought the div printing and colorbox printing are possible duplicates?!! – AlwaysANovice Jan 31 '14 at 02:00
  • @Walahh what are the differences??!!, from my limited knowledge, I think `colorbox` is build with `div`s and/or `span`s??!! – arun Jan 31 '14 at 04:08

3 Answers3

0

You can try this:

$(".print-invoice").click(function() {
    $('#the_Iframe_ID')[0].print();
});
Zuul
  • 16,217
  • 6
  • 61
  • 88
0

Its a few months late, but for the benefit of anyone else who may come across this: If you use an iframe to display the content, then a print button in that content will only print whats in the colorbox. To use an iframe, set the iframe setting to true:

$(document).ready(function(){
    $(".linktocolorbox").colorbox({iframe:true});
});
FluffyKitten
  • 13,824
  • 10
  • 39
  • 52
0

Here is my solution on inner HTML with multiple divs with same class

https://stackoverflow.com/a/32580793/3888517

Community
  • 1
  • 1
Stefan
  • 627
  • 6
  • 19