+ 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.
4 Answers
+ 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 ^^
+ 3
You can use Javascript to disable the elements before execute print function.
+ 2
Just run
window.print();
0
No but that will print the entire window. I want just the table to be printed