javascript - After print function not able to click other tabs -


i using default print function printing, once print function completed not able click other tabs. print window opening in same page

function printreport() {     var divelements = $('.nicedit-main').html();     var oldpage = document.body.innerhtml;     document.body.innerhtml = "<html><head><title></title></head><body>" + divelements + "</body>";     window.print();     document.body.innerhtml = oldpage; } 

unfortunately, replaced entire body of page. innerhtml returns string form of html minus handlers , data attached elements. setting innerhtml recreates dom string without handlers attached. "effectively" paralyzed page!

i suggest:

  • the hard way continue doing, delegate handlers document how live have done won't removed. hard, possible, not scalable, maintainable or optimal.

  • or create hidden iframe , place content printed there. call print iframe window instead. way, won't lose current page.

  • others create new window, put content there, run print , close after. works same iframes, wouldn't want creepy window opens , closes pop-up ad.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -