+ 1

How to print a table in html using js?

I have created a billing program for a restaurant in which i have a bill table. I want that only this table should be printed. I have tried some methods but the input field and table border is not getting printed. Can someone suggest some method? Thanks in advance.

8th Jul 2017, 12:38 PM
Rishubh Naik
Rishubh Naik - avatar
4 Antworten
+ 4
I've never had such task to solve, but I can imagine do it by two ways: + open a new window/tab and document.write() only your table with the desired layout/style, and use the window.print() method (this is a common way to do that you often encounter in web site) + define specific css styles targeting 'print' medias, in wich you hidde all the stuff of your page you don't want to print ('display:none;' css property/value), and style the table at your convenience... so use window.print() also ^^
8th Jul 2017, 3:49 PM
visph
visph - avatar
+ 3
You can use Javascript to disable the elements before execute print function.
8th Jul 2017, 1:22 PM
Calviղ
Calviղ - avatar
+ 2
Just run window.print();
8th Jul 2017, 12:50 PM
Calviղ
Calviղ - avatar
0
No but that will print the entire window. I want just the table to be printed
8th Jul 2017, 1:11 PM
Rishubh Naik
Rishubh Naik - avatar