8. Write a jQuery code to print a page
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<title>Print a page using jQuery</title>
<script>
$('btn.printPage').click(function(){
window.print();
return false;
});
</script>
<p>Click the button to print the current page.</p>
<button onclick="window.print()">Print this page</button>
</head>
<body>
</body>
</html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<title>Print a page using jQuery</title>
<script>
$('btn.printPage').click(function(){
window.print();
return false;
});
</script>
<p>Click the button to print the current page.</p>
<button onclick="window.print()">Print this page</button>
</head>
<body>
</body>
</html>
//Output
No comments:
Post a Comment