Reputation: 13
I would like to copy a part of my html on iframe to print it. so using VueJs i did this code.
Print:function(){
var element = document.getElementById('content');
printf.document.body.innerHTML = element;
window.frames["printf"].focus();
window.frames["printf"].print();
},
the result is an iframe with : [object HTMLElement]
.
But When i do a simple test like this one :
Print:function(){
var element = 'TEST';
printf.document.body.innerHTML = element;
window.frames["printf"].focus();
window.frames["printf"].print();
},
A got a printable iframe with TEST
My content
element is something complicated with full css, tables, pictures etc.. Any orientation ? Thank you !
Upvotes: 0
Views: 205
Reputation: 35096
printf.document.body.innerHTML = element
should be printf.document.body.innerHTML = element.innerHTML
I think. But you may actually want to use .outerHTML
Upvotes: 1