Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

html print div

function PrintElem(elem)
{
    var mywindow = window.open('', 'PRINT', 'height=400,width=600');

    mywindow.document.write('<html><head><title>' + document.title  + '</title>');
    mywindow.document.write('</head><body >');
    mywindow.document.write('<h1>' + document.title  + '</h1>');
    mywindow.document.write(document.getElementById(elem).innerHTML);
    mywindow.document.write('</body></html>');

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10*/

    mywindow.print();
    mywindow.close();

    return true;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: uuid for react native 
Javascript :: javascript split by newline 
Javascript :: Uncaught Error: "arc" is not a registered element. 
Javascript :: trigger on change 
Javascript :: console.log regex 
Javascript :: javascript sort alphabetically 
Javascript :: jquery find parent 
Javascript :: get text of selected option js 
Javascript :: fizzbuzz js 
Javascript :: jquery on 2 events 
Javascript :: can we use two versions of jquery in same page 
Javascript :: stop next script when ajaxcall 
Javascript :: monitor changes made to object 
Javascript :: reactjs compile subdomine 
Javascript :: queryselector with ul and not selecting particular li with id 
Javascript :: set value of radio button jquery 
Javascript :: discord.js join voice channel 
Javascript :: button click javascript 
Javascript :: javascript set file input value to null 
Javascript :: javascript removing item from array 
Javascript :: ^(?:(+|00)d{1,3}[-s.])?(()?d{3,10}())?(?:[-s.)]d{2,7}([-s.]d{2,5})?([-s.]d{2})?)?$ 
Javascript :: add 2 microseconds to Date() js 
Javascript :: delete from array in angular 
Javascript :: remove tr having delete icon inside jquery 
Javascript :: regex for ip address javascript 
Javascript :: jest test coverage command 
Javascript :: how to give a label padding through jquery 
Javascript :: Why messageReactionAdd do nothing discord.js 
Javascript :: how to put variable in string javascript 
Javascript :: SyntaxError: Cannot use import statement outside a module node js 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =