Print button that prints only what’s within a div tag

Do you want to have a button on a webpage that allows the user to print only a portion of the content on the webpage?   One approach is to setup your webpage so that the “print” button will only print the content that you put within a ”

” tag.
NOTE:   another approach to printing only part of a webpage is shown here:
Step 1 – Put this Javascript in your webpage:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}
Step 2 – Put a div tag around part of your webpage with an ID:
 content you want to print here….
Step 3 – Put a button inside your div tag so a user can print the div tag
<input type='button' value='Print This Only' onclick="printDiv('example');"/>"

Placeholder in jquery

If you want that your placeholder text remove on focusin and focusout please try this –

$('textarea, input').focusin(function () {
input = $(this);
input.data('place-holder-text', input.attr('placeholder'))
input.attr('placeholder', '');
});

$('textarea, input').focusout(function () {
input = $(this);
input.attr('placeholder', input.data('place-holder-text'));
});