daniel.tosaba
daniel.tosaba

Reputation: 2563

javascript print iframe doesn't work in firefox

I have tested this in Chrome and all good, but Firefox is lazy. Part of HTML in question:

<div id="print" style="display:none;"></div>

And Javascript follows it like:

$('.print').click(function(){
               printF($(this));
               return false;
            });



 function printF(dugme){
            $('#print').html("<iframe src='http://example.comli.com/index.php/prijava/pogledaj/"+$(dugme).attr('name') +"' onLoad='this.contentWindow.print();'></iframe>");
        };

Thank you

Upvotes: 0

Views: 1414

Answers (1)

Matthew
Matthew

Reputation: 8416

Is the problem that the click event is not getting fired or that your IFRAME is not getting loaded?

Anyway, I think I got this working in Firefox. I had to put your click function into the document#ready event though. Like this:

$(function(){
   $('.print').click(function(){
      printF($(this));
      return false;
   });
});

Upvotes: 1

Related Questions