Monday, April 23, 2012

How can I print the contents of a link?

I want the contents of a link get printed by jQuery. How to do it?



Following is my code:

DEMO:



<a href="#" onclick="window.print(); return false;">Print</a> 
?
$(document).ready(function() {
$('ul#tools').prepend('<li class="print"><a href="#print">Click me to print</a></li>');
$('ul#tools li.print a').click(function() {
window.open('www.google.com');
window.print();
return false;
});
}); ?




No comments:

Post a Comment