Friday, 24 June 2016

Print option in web page

  <!--Include JQuery header file -->
 <!--prin script put it in end of the body -->
    <script type="text/javascript">
        $(document).ready()
        {
            function printData() {
                //alert(1);
                var divToPrint = document.getElementById("PrintelementID");
                newWin = window.open("");
                newWin.document.write(divToPrint.outerHTML);
                newWin.print();
                newWin.close();
            }
         //btnPrint button id
            $('#btnPrint').on('click', function () {
                               printData();
            })

        }
    </script>

No comments:

Post a Comment