How do I print the indicated div (without manually disabling all other content on the page)?
I want to avoid a new preview dialog, so creating a new window with this
base on @Kevin Florida answer, i made a way to avoid script on current page disable because of overwrite content. I use other file called "printScreen.php" (or .html). Wrap everything you want to print in a div "printSource". And with javascript, open a new window you created before ("printScreen.php") then grab content in "printSource" of top window.
Here is the code.
Main window :
echo "";
//everything you want to print here
echo "";
//add button or link to print
echo "";
This is "printScreen.php" - other file to grab content to print
// write everything about style/script here (.css, .js)