How to call Primefaces JavaScript function after pageload?

I am using custom buttons for PrimefaceWizard and remove default navigation buttons from Primeface Wizard by adding the attribute showNavBar="false" .

<p:wizard style="border:0" showNavBar="false" widgetVar="terminationWizard"  onback="if (PF('terminationWizard').getStepIndex(PF('terminationWizard').currentStep) === 0) { PF('stepBackward').disable(); } PF('stepForward').enable();"
 onnext="if (PF('terminationWizard').getStepIndex(PF('terminationWizard').currentStep) === 1) { PF('stepForward').disable(); } PF('stepBackward').enable();" >

Buttons code

<p:commandButton widgetVar="stepBackward" value="Back"  
 onclick="PF('terminationWizard').back()" />

<p:commandButton value="Next"  onclick="PF('terminationWizard').next();" widgetVar="stepForward"/>

But issue is that when Wizard page loading it showing Back button in first tab which i will want to disable or remove from the page when i am in first tab. Tried to add jquery like this

<script>
    jQuery(document).ready(function() {
        PF('terminationWizard').hideBackNav();
    });
</script>

But it is not working. Can any one please tell me what other way to do it.

Answers:

Answer
Maybe a small delay will solve the problem :

<script>
    jQuery(document).ready(function() {
        setTimeout(function(){
           PF('terminationWizard').hideBackNav();
        }, 700);
    });
</script>

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.