Answers for "print value in javascript <a> tag"

10

how to code print in javascript

console.log("print")
//or
alert("Print")
Posted by: Guest on April-07-2020
0

document print from html javascript

export default function printDiv({divId, title}) {
  let mywindow = window.open('', 'PRINT', 'height=650,width=900,top=100,left=150');

  mywindow.document.write(`<html><head><title>${title}</title>`);
  mywindow.document.write('</head><body >');
  mywindow.document.write(document.getElementById(divId).innerHTML);
  mywindow.document.write('</body></html>');

  mywindow.document.close(); // necessary for IE >= 10
  mywindow.focus(); // necessary for IE >= 10*/

  mywindow.print();
  mywindow.close();

  return true;
}
Posted by: Guest on February-24-2022

Browse Popular Code Answers by Language