Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Print Preview Plugin not working with <h:commandLink>
    primarykey
    data
    text
    <p>I am trying to use <a href="https://github.com/etimbo/jquery-print-preview-plugin" rel="nofollow">jQuery Print Preview Plugin</a> to show the prieview of a JSF page before printing it.</p> <p>First I tried a demo with plain <code>HTML</code> tags.</p> <pre><code>&lt;script src="../js/jquery.print-preview.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var $j = jQuery.noConflict(); $j(function() { alert("hai"); /* * Initialise print preview plugin */ $j('.print-preview').printPreview(); alert("bye"); }); &lt;/script&gt; &lt;div id="header" class="container_12"&gt; &lt;a class="print-preview"&gt;Print this Page&lt;/a&gt; &lt;/div&gt; </code></pre> <p>I works correctly and the print -preview modal dailog is opened.</p> <p>However,when i try replacing the <code>&lt;a&gt;</code> tag with <code>&lt;h:commandLink&gt;</code> the <code>$(this).bind('click', function(e)</code> within the <code>print-preview.js</code> is not triggered.</p> <pre><code>&lt;h:form id="printForm"&gt; &lt;script src="../js/jquery.print-preview.js" type="text/javascript" charset="utf-8"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var $j = jQuery.noConflict(); $j(function() { alert("hai"); /* * Initialise print preview plugin */ $j('.print-preview').printPreview(); alert("bye"); }); &lt;/script&gt; &lt;div id="header" class="container_12"&gt; &lt;h:commandLink id="sample" value="Print this page" styleClass="print-preview"/&gt; &lt;/div&gt; &lt;/h:form&gt; </code></pre> <p>I even tried using <code>$j('printForm\\:sample').printPreview();</code>, but still it is not working.</p> <p>Am I doing something wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload