2

How to print the user input textbox. In the current jsfiddle I have attached my demo. I am using windows popup to display current HTML in a new page and print only the displayed items. How do I display input box values in the current popup?

https://jsfiddle.net/amitk009/xuf29hkr/

print(){
      var DocumentContainer = document.getElementById('print-area');   

    var strHtml = '<html><head>'+
    '</head>' +    
    '<body style="margin-top:10px">' +     
    '<div class="card"><div class="card-header"><</div>' +
    '<div class="card-body">' +
    DocumentContainer.innerHTML + 
    '</div></div>' +     
    '</body>\n</html>';

    var WindowObject = window.open('', '_blank', 'width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
    WindowObject.document.write(strHtml);
    WindowObject.document.close();
    WindowObject.focus();
    setTimeout(function(){
      WindowObject.print();
      WindowObject.close();
    },1000);

   return true;
    }
BUlle7
  • 153
  • 3
  • 15

0 Answers0