Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda