Skip to content

Instantly share code, notes, and snippets.

@export-mike
Created February 27, 2015 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save export-mike/07ab376dd666545c64c0 to your computer and use it in GitHub Desktop.
Save export-mike/07ab376dd666545c64c0 to your computer and use it in GitHub Desktop.
A simple hide and show printable areas. see example on jsfiddle: http://jsfiddle.net/57tyc9kj/
(function ($) {
$('.print-me').on('click', function () {
var $areaToPrint = $($(this).data('print-me'));
var $hiddenAreas = $('.hide-print');
if ($areaToPrint.length) {
$hiddenAreas.hide();
$areaToPrint.show();
window.print();
$hiddenAreas.show();
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment