Print a div content using Jquery

前端 未结 13 2234
栀梦
栀梦 2020-11-30 05:22

I want to print the content of a div using jQuery. This question is already asked in SO, but I can\'t find the correct (working) answer.

This is is my HTML:

13条回答
  •  生来不讨喜
    2020-11-30 06:06

    Without using any plugin you can opt this logic.

    $("#btn").click(function () {
        //Hide all other elements other than printarea.
        $("#printarea").show();
        window.print();
    });
    

提交回复
热议问题