Print using jQuery
Introduction: Hello Guys, “Welcome back” Today i am here with another one new great article. In this article I will explain about the implementation print option using jQuery. On the button click you can print webpage.
Code for HTML Page
Implementation: On the HTML page I will place a button control with the id named btn_Print. I also create a function on button click by using the id of the button. In this function I will use JavaScript function window.print() to print the whole webpage.
Here i am giving the complete code for HTML page. You can copy and paste the code on your HTML page and enjoy the execution of the code.
<!DOCTYPE html>
<html>
<head>
<title>>How to print a page using jQuery?</title>
<style>
div {
text-align: center;
}
</style>
</head>
<body>
<div>
<h1><a href="https://usingaspdotnet.blogspot.com" target="_blank">Using ASp.Net</a></h1>
<h3>print page using jQuery</h3>
<button id="btn_Print">
Click here to Print Page
</button>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity=
"sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<script>
$('#btn_Print').click(function () {
window.print();
return false;
});
</script>
</html>
Conclusion: In above code, I explained that implementation the print option using jQuery. This code is very helpful for every developer. Bye Bye and take care of you Developers. We will come back shortly with the new article.
Regards
Using Asp.net
Comments
Post a Comment