title: Print Content Of Bootstrap Modal Window
body: <p>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.</p>
  <pre><code>                            &lt;div class=&quot;modal-footer&quot;&gt;
  
                                  &lt;button type=&quot;button&quot; class=&quot;btn btn-secondary&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
                                  &lt;button id=&quot;btnPrint&quot; type=&quot;button&quot; class=&quot;btn btn-default&quot;&gt;Print&lt;/button&gt;
                                  
  
                                  &lt;script&gt;
                                  document.getElementById(&quot;btnPrint&quot;).onclick = function() {
                                      printElement(document.getElementById(&quot;printThis&quot;));
                                  }
  
                                  function printElement(elem) {
                                      var domClone = elem.cloneNode(true);
  
                                      var $printSection = document.getElementById(&quot;printSection&quot;);
  
                                      if (!$printSection) {
                                          var $printSection = document.createElement(&quot;div&quot;);
                                          $printSection.id = &quot;printSection&quot;;
                                          document.body.appendChild($printSection);
                                      }
  
                                      $printSection.innerHTML = &quot;&quot;;
                                      $printSection.appendChild(domClone);
                                      window.print();
                                  }
                                  &lt;/script&gt;
  </code></pre>