Skip to content

Instantly share code, notes, and snippets.

// Create a jquery plugin that prints the given element.
jQuery.fn.print = function(){
// NOTE: We are trimming the jQuery collection down to the
// first element in the collection.
if (this.length > 1){
this.eq( 0 ).print();
return;
} else if (!this.length){
return;
}