Ever came across a need where you want to print the HTML form or page. This is possible using the JavaScript window.print() function. You can use this code with any control (like Button) and even any event (like onclick). This will simply bring up the printer options from your machine and then you can follow the normal procedure of printing.
Note - A printer must be configured on your machine.
window.print();
This will not directly print the page, similar to the way you do it on your machine. The printer options window will show and you can make adjustments and settings before actually printing the contents.
More Posts related to JavaScript,
- Meaning of javascript:void(0) explained with example
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get UTC (GMT) time using JavaScript
- Add Animated Scrolling to Html Page Title Script
- Examples: Convert String to int in JavaScript
- Get Device Screen Width and Height using javaScript
- Remove items from JavaScript array
- Javascript convert text case from uppercase to lowercase
- [javaScript] Convert text case to lowercase
- How to detect Browser and Operating System Name and Version using JavaScript
- How to send email from JavaScript HTML using mailto
- How to check if a String contains substring or a word using javaScript
- Send Extra Data with Ajax Get or Post Request
- How to get query string in JavaScript HTML location.search
- How to get current URL Location using Javascript HTML
- JavaScript: Check if variable is a number
- JavaScript : Get current page address
- JavaScript: Count Words in a String
- Loading previous page using html button using JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
- How to Print from JavaScript HTML using window.print
- Submit html form on dropdown menu value selection or change using javascript
- Detect if Cookies are enabled using JavaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript date in yyyy-MM-dd format
More Posts:
- Android Activity Main xml stuck loading - Android-Studio
- How to create StackOverflow error in java - Java
- How to fix: You will need Google Chrome to install most apps, extensions and themes. - Chrome
- Sublime Text 3 Convert Case to Upper, Lower, Title or Swap - Sublime-Text
- Java -Day of the week using Java 8 DayOfWeek Enum - Java
- SharePoint list excel import error - Title is a required filed and can't be empty - SharePoint
- How to send SMS on Android Emulator - Android
- Users experience call quality issue, voice distortion, disconnection with Microsoft Teams call and meeting - Teams