Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Print Content Of Bootstrap Modal Window

I have a table in laravel with different data in the lines and a button that opens a mondal with the information, but when I open the modal and click on the button inside the modal to print it does not work.

                            <div class="modal-footer">

                                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                <button id="btnPrint" type="button" class="btn btn-default">Print</button>
                                

                                <script>
                                document.getElementById("btnPrint").onclick = function() {
                                    printElement(document.getElementById("printThis"));
                                }

                                function printElement(elem) {
                                    var domClone = elem.cloneNode(true);

                                    var $printSection = document.getElementById("printSection");

                                    if (!$printSection) {
                                        var $printSection = document.createElement("div");
                                        $printSection.id = "printSection";
                                        document.body.appendChild($printSection);
                                    }

                                    $printSection.innerHTML = "";
                                    $printSection.appendChild(domClone);
                                    window.print();
                                }
                                </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<button id="btnPrint"type="button" class="btn btn-default">Print</button>

Simply add onclick="window.print()" in your button tag and remove rest of script.

Please let me know if it works.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!