Search code examples
jqueryprintingpopupsimplemodal

Print function on jQuery SimpleModal


I'm using the Basic Modal Dialog from here http://www.ericmmartin.com/projects/simplemodal-demos/ and inside of this dialog, I have an image which I would like to add a Print button below it.

I've tried using jqPrint but it doesn't work. Is there something that I've missed?

My popup dialog

<div id="popup_name" class="popup_block">
<div class="map"><img src="images/map.png"></div>
<br><a href="#" id="print"><img src="images/print.png"></a>
</div>

jqPrint

$("#print").click( function() { 
$('.map').jqprint(); 
}); 
</script> 

Solution

  • IMP: jqprint() is a plug-in, add proper reference to your file. Try putting your click function in document.ready, it should work fine then.

    $(document).ready(function () {
    $("#print").click( function() { 
    $('.map').jqprint(); 
    });
    });
    

    I have tested this, it works fine.