View jQuery.print on GitHub

Element 1

Some random text.

Element 2

Some other random text.

Element 3

Some more random text that is not to be printed.

Element 4

Some really random text.


                $("#ele4").find('button').on('click', function() {
                    //Print ele4 with custom options
                    $("#ele4").print({
                        //Use Global styles
                        globalStyles : false,
                        //Add link with attrbute media=print
                        mediaPrint : false,
                        //Custom stylesheet
                        stylesheet : "http://fonts.googleapis.com/css?family=Inconsolata",
                        //Print in a hidden iframe
                        iframe : false,
                        //Don't print this
                        noPrintSelector : ".avoid-this",
                        //Add this at top
                        prepend : "Hello World!!!<br/>",
                        //Add this on bottom
                        append : "<span><br/>Buh Bye!</span>",
                        //Log to console when printing is done via a deffered callback
                        deferred: $.Deferred().done(function() { console.log('Printing done', arguments); })
                    });
                    // Fork https://github.com/doersguild/jQuery.print for the full list of options