Reputation: 17
My print function button doesn't seem to work upon clicking. The print view page does not show.
Here is the html code:
<button class = "hidden-print" id = "print-click">Print New Orders</button>
Here is the js code:
function printNewOrders(){
window.print();
$("#print-click").click(printNewOrders);
}
Upvotes: 0
Views: 372
Reputation: 67187
Your click event won't be bound unless you call the function printNewOrders
. Even though if you call it the page will be printed without user's intervention. So change your code like below,
function printNewOrders(){
window.print();
}
$("#print-click").click(printNewOrders);
Upvotes: 1