繁体   English   中英

window.print()从页面打印后的复选框中删除复选标记

[英]window.print() removing check marks from checkboxes after page prints

我使用icheck单选按钮和复选框创建了一个清单。 我还有一个按钮,可以打印清单。

<style>
  @media print {
  #printpage {
    display: none;
  }
  #submit {
    display: none;
  }
  .noprint {
    display: none;
  }
  input[type=checkbox], input[type=radio] {
        opacity: 1 !important;
    }
}
</style>

<div class="row">
    <div class="col-lg-12">
        <div class="form-group i-checks">
            <input type="checkbox" name="poa" id="poa" />
            <strong><a href="forms/poa.cfm" target="_blank">Power of Attorney - if applicable (click here to print)</a></strong>
        </div>
    </div>
</div>

    <button class="btn-u btn-u-orange"  onclick="printChecklist()" name="printpage" id="printpage" ><i class="icon-printer"></i> Print Checklist</button>

    <script>
    function printChecklist() {
        window.print();
    }
    </script>

我遇到的问题是,一旦我选择打印所有复选框,然后再次取消选中,就像页面已刷新或其他东西一样。

有没有办法让我的按钮打印页面但不取消选中我的所有复选框,离开屏幕就像用户按下打印按钮时的方式一样?

如果其他任何人遇到我遇到的这个问题。 我最终找到的是我删除了脚本函数并将按钮的onclick更改为onclick="window.print(); return false;"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM