我正在尝试仅打印颜色框的内容
$(".print-invoice").on("click", function(event){
window.print();
return false;
});
这会打印整个页面,文件路径是 popups/info.html
它晚了几个月,但为了其他可能遇到此问题的人的利益:如果您使用 iframe 显示内容,则该内容中的打印按钮只会打印颜色框中的内容。要使用 iframe,请将iframe
设置设置为 true:
$(document).ready(function(){
$(".linktocolorbox").colorbox({iframe:true});
});
你可以试试这个:
$(".print-invoice").click(function() {
$('#the_Iframe_ID')[0].print();
});
这是我对内部 HTML 的解决方案,其中包含多个具有相同类的 div