当我使用Jquery插入"PrintThis“时,
html函数:<div style='page-break-after:always'></div>
停止工作。好吧,"PrintThis",不会打破页面的!
我怎么才能解决这个问题?
我应该在JS里放“断线”吗?多么?
用同一个表号可以吗?
//Print Btn
<button id="print_btn">btn</button>
//Table 1
<table id="table" class="display">
<tr><td>Hi</td></tr>
</table>
//Break page here
<div style='page-break-after:always'></div>
//Table 2
<table id="table" class="display">
<tr><td>Hi</td></tr>
</table>JS
$(document).ready(function () {
$('#print_btn').click(function () {
$('#table').printThis();
});
});发布于 2015-03-11 06:48:15
嗯,这个脚本的解决方案再一次很容易解决。(只是睡了一觉=)
//ADD class "display" and id.
<div class="display" id "break_page" style='page-break-after:always'></div>JS
//Add id "break_page" to JS
$(document).ready(function () {
$('#print_btn').click(function () {
$('#table, #break_page').printThis();
});
});发布于 2018-06-22 09:57:43
break-after属性在不生成方框的元素上被忽略。您应该在table上使用这种样式,而不是在div上使用
https://stackoverflow.com/questions/28962486
复制相似问题