janmichael mallari
janmichael mallari

Reputation: 27

How can I have a Print Method, Using JavaScript

I want to my webpage to have a print button, Like this.

<button>Print</button>

then when you click the print button. they will pop up a print properties,

Thanks for helping.

Upvotes: 1

Views: 46

Answers (2)

DaveE
DaveE

Reputation: 1643

This should do the trick. Using JavaScript's print method:

 <button onclick='window.print();'>Print</button>

Upvotes: 3

Alan
Alan

Reputation: 3002

This should be as simple as:

<button onclick="window.print()">Print</button>

Upvotes: 1

Related Questions