6 Answers. Use <br /> to print text on new line. When you are putting the content in DOM . n will just add a space instead of newline.2 мая 2019 г.
- function printData()
- var divToPrint=document. getElementById(“printTable”);
- newWin= window. open(“”);
- newWin. write(divToPrint. outerHTML);
- newWin. print();
- newWin. close();
You can place any number of scripts in an HTML document. Scripts can be placed in the <body> , or in the <head> section of an HTML page, or in both.
What is print () in Java?
print(): print() method in Java is used to display a text on the console. This text is passed as the parameter to this method in the form of String. This method prints the text on the console and the cursor remains at the end of the text at the console. The next printing takes place from just here.
How do you print HTML code?
Printing an HTML Document
- Open a document in the HTML editor.
- Do one of the following: On the main menu, click File > Print. Press CTRL+P. The document prints as it appears in the HTML editor, NOT as it appears in a browser.
- Horizontal Tab is replaced with t.
- Vertical Tab is replaced with v.
- Nul char is replaced with .
- Backspace is replaced with b.
- Form feed is replaced with f.
- Newline is replaced with n.
A Document object represents the HTML document that is displayed in that window. The Document object has various properties that refer to other objects which allow access to and modification of document content. The way a document content is accessed and modified is called the Document Object Model, or DOM.
What is jQuery code?