Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda