Printing the Page

1 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€87.05
List Price:  €121.87
You save:  €34.82
£75.39
List Price:  £105.55
You save:  £30.15
CA$137.51
List Price:  CA$192.52
You save:  CA$55.01
A$144.42
List Price:  A$202.20
You save:  A$57.77
S$128.62
List Price:  S$180.08
You save:  S$51.45
HK$782.89
List Price:  HK$1,096.08
You save:  HK$313.18
CHF 79.37
List Price:  CHF 111.12
You save:  CHF 31.75
NOK kr977.42
List Price:  NOK kr1,368.43
You save:  NOK kr391
DKK kr650.45
List Price:  DKK kr910.66
You save:  DKK kr260.20
NZ$173.37
List Price:  NZ$242.72
You save:  NZ$69.35
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,287.70
List Price:  ৳17,203.27
You save:  ৳4,915.57
₹9,403.88
List Price:  ₹13,165.81
You save:  ₹3,761.93
RM393.91
List Price:  RM551.49
You save:  RM157.58
₦136,796.31
List Price:  ₦191,520.31
You save:  ₦54,724
₨27,960.05
List Price:  ₨39,145.18
You save:  ₨11,185.13
฿3,302.26
List Price:  ฿4,623.30
You save:  ฿1,321.04
₺4,432.63
List Price:  ₺6,205.86
You save:  ₺1,773.23
B$535.75
List Price:  B$750.07
You save:  B$214.32
R1,718.62
List Price:  R2,406.14
You save:  R687.52
Лв170.23
List Price:  Лв238.33
You save:  Лв68.09
₩151,601.20
List Price:  ₩212,247.75
You save:  ₩60,646.54
₪315
List Price:  ₪441.01
You save:  ₪126.01
₱6,044.19
List Price:  ₱8,462.11
You save:  ₱2,417.91
¥15,961.07
List Price:  ¥22,346.14
You save:  ¥6,385.06
MX$1,807.67
List Price:  MX$2,530.82
You save:  MX$723.14
QR366.19
List Price:  QR512.68
You save:  QR146.49
P1,365.54
List Price:  P1,911.81
You save:  P546.27
KSh12,958.70
List Price:  KSh18,142.70
You save:  KSh5,184
E£5,224.27
List Price:  E£7,314.19
You save:  E£2,089.92
ብር15,782.03
List Price:  ብር22,095.47
You save:  ብር6,313.44
Kz91,203.97
List Price:  Kz127,689.21
You save:  Kz36,485.24
CLP$93,448.59
List Price:  CLP$130,831.77
You save:  CLP$37,383.17
CN¥691.08
List Price:  CN¥967.54
You save:  CN¥276.46
RD$5,944.37
List Price:  RD$8,322.36
You save:  RD$2,377.98
DA13,276.16
List Price:  DA18,587.16
You save:  DA5,310.99
FJ$223.39
List Price:  FJ$312.76
You save:  FJ$89.36
Q767.08
List Price:  Q1,073.94
You save:  Q306.86
GY$20,950.87
List Price:  GY$29,332.05
You save:  GY$8,381.18
ISK kr12,496.75
List Price:  ISK kr17,495.95
You save:  ISK kr4,999.20
DH935.74
List Price:  DH1,310.08
You save:  DH374.33
L1,749.46
List Price:  L2,449.31
You save:  L699.85
ден5,365.14
List Price:  ден7,511.41
You save:  ден2,146.27
MOP$808.31
List Price:  MOP$1,131.67
You save:  MOP$323.36
N$1,689.30
List Price:  N$2,365.09
You save:  N$675.78
C$3,684.83
List Price:  C$5,158.92
You save:  C$1,474.08
रु14,978.94
List Price:  रु20,971.11
You save:  रु5,992.17
S/346.21
List Price:  S/484.71
You save:  S/138.50
K432.26
List Price:  K605.18
You save:  K172.92
SAR375.47
List Price:  SAR525.68
You save:  SAR150.20
ZK1,955.26
List Price:  ZK2,737.45
You save:  ZK782.18
L443.82
List Price:  L621.37
You save:  L177.54
Kč2,134.68
List Price:  Kč2,988.64
You save:  Kč853.96
Ft34,309.96
List Price:  Ft48,035.32
You save:  Ft13,725.36
SEK kr949.24
List Price:  SEK kr1,328.97
You save:  SEK kr379.73
ARS$139,140.33
List Price:  ARS$194,802.03
You save:  ARS$55,661.70
Bs691.95
List Price:  Bs968.76
You save:  Bs276.81
COP$370,281.66
List Price:  COP$518,409.14
You save:  COP$148,127.47
₡46,774.45
List Price:  ₡65,486.10
You save:  ₡18,711.65
L2,650.65
List Price:  L3,711.02
You save:  L1,060.36
₲654,064.06
List Price:  ₲915,715.85
You save:  ₲261,651.78
$U4,073.52
List Price:  $U5,703.09
You save:  $U1,629.57
zł373.20
List Price:  zł522.50
You save:  zł149.29
Already have an account? Log In

Transcript

Hello, in this JavaScript video, I am going to show you how to trigger the print method. So if you go to like Chrome or Firefox to do click Print, you know, this little thing gets triggered and obviously there's nothing in there to print. So if I were to just simply print other h1 Hello, well and go back go to here, print. Oh, I forgot to reload it. My bad. Oh, I wonder why did that not work?

There we go. Okay, so if you want to actually trigger it programmatically, so like a button on your website triggers the print method. You can do that pretty easily. So I'll create a div and this will have an on click event. Oh, Click equals, print and print the page. Now what we do in here, we're gonna create a function called print up.

And then in here to print, it's actually really simple. You just do window, print, not Pre Owned, print, reload, click Print the page, as it says trigger there, and it's printing the entire page. And honestly, that's it. That's all there is to triggering the print event in a web browser via your website. If you have any questions, feel free to pop me a message. As usual, there will be a GitHub link to all of the source code and I look forward to seeing you in the next video.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.