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
€84.46
List Price:  €118.25
You save:  €33.79
£73.27
List Price:  £102.58
You save:  £29.31
CA$137.74
List Price:  CA$192.84
You save:  CA$55.10
A$150.28
List Price:  A$210.40
You save:  A$60.11
S$127.86
List Price:  S$179.01
You save:  S$51.15
HK$777.68
List Price:  HK$1,088.79
You save:  HK$311.10
CHF 78.77
List Price:  CHF 110.28
You save:  CHF 31.51
NOK kr980.74
List Price:  NOK kr1,373.07
You save:  NOK kr392.33
DKK kr630.47
List Price:  DKK kr882.69
You save:  DKK kr252.21
NZ$169.27
List Price:  NZ$236.99
You save:  NZ$67.71
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,185.31
List Price:  ৳17,059.92
You save:  ৳4,874.61
₹8,811.41
List Price:  ₹12,336.33
You save:  ₹3,524.92
RM419.55
List Price:  RM587.39
You save:  RM167.84
₦149,429.05
List Price:  ₦209,206.65
You save:  ₦59,777.60
₨28,401.48
List Price:  ₨39,763.21
You save:  ₨11,361.73
฿3,178.98
List Price:  ฿4,450.70
You save:  ฿1,271.72
₺4,131.33
List Price:  ₺5,784.03
You save:  ₺1,652.69
B$533.15
List Price:  B$746.44
You save:  B$213.28
R1,735.26
List Price:  R2,429.44
You save:  R694.17
Лв165.36
List Price:  Лв231.51
You save:  Лв66.15
₩138,526.83
List Price:  ₩193,943.10
You save:  ₩55,416.27
₪334.31
List Price:  ₪468.04
You save:  ₪133.73
₱5,702.16
List Price:  ₱7,983.25
You save:  ₱2,281.09
¥14,726.04
List Price:  ¥20,617.04
You save:  ¥5,891
MX$1,826.26
List Price:  MX$2,556.84
You save:  MX$730.57
QR365
List Price:  QR511.02
You save:  QR146.01
P1,418.71
List Price:  P1,986.26
You save:  P567.54
KSh12,913.70
List Price:  KSh18,079.70
You save:  KSh5,166
E£4,817.39
List Price:  E£6,744.55
You save:  E£1,927.15
ብር14,488.01
List Price:  ብር20,283.80
You save:  ብር5,795.78
Kz91,186.38
List Price:  Kz127,664.58
You save:  Kz36,478.20
CLP$95,246.47
List Price:  CLP$133,348.87
You save:  CLP$38,102.40
CN¥710.50
List Price:  CN¥994.74
You save:  CN¥284.23
RD$6,225.40
List Price:  RD$8,715.82
You save:  RD$2,490.41
DA12,927.13
List Price:  DA18,098.50
You save:  DA5,171.37
FJ$224
List Price:  FJ$313.61
You save:  FJ$89.61
Q766.66
List Price:  Q1,073.36
You save:  Q306.69
GY$20,938.51
List Price:  GY$29,314.75
You save:  GY$8,376.24
ISK kr12,061.79
List Price:  ISK kr16,886.99
You save:  ISK kr4,825.20
DH898.43
List Price:  DH1,257.84
You save:  DH359.41
L1,653.42
List Price:  L2,314.85
You save:  L661.43
ден5,203.15
List Price:  ден7,284.62
You save:  ден2,081.46
MOP$801.62
List Price:  MOP$1,122.31
You save:  MOP$320.68
N$1,740.46
List Price:  N$2,436.72
You save:  N$696.25
C$3,682.88
List Price:  C$5,156.18
You save:  C$1,473.30
रु14,057.89
List Price:  रु19,681.61
You save:  रु5,623.72
S/348.15
List Price:  S/487.43
You save:  S/139.27
K418.35
List Price:  K585.71
You save:  K167.35
SAR375.03
List Price:  SAR525.06
You save:  SAR150.02
ZK2,344.31
List Price:  ZK3,282.12
You save:  ZK937.81
L428.13
List Price:  L599.40
You save:  L171.27
Kč2,054.61
List Price:  Kč2,876.54
You save:  Kč821.93
Ft32,836.53
List Price:  Ft45,972.46
You save:  Ft13,135.92
SEK kr927.58
List Price:  SEK kr1,298.65
You save:  SEK kr371.07
ARS$147,359.02
List Price:  ARS$206,308.52
You save:  ARS$58,949.50
Bs691.58
List Price:  Bs968.24
You save:  Bs276.65
COP$386,929.40
List Price:  COP$541,716.65
You save:  COP$154,787.24
₡50,433.99
List Price:  ₡70,609.61
You save:  ₡20,175.61
L2,624.11
List Price:  L3,673.86
You save:  L1,049.75
₲714,143.32
List Price:  ₲999,829.21
You save:  ₲285,685.89
$U3,999.43
List Price:  $U5,599.36
You save:  $U1,599.93
zł359.58
List Price:  zł503.43
You save:  zł143.84
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.