You need to sign in to do that
Don't have an account?

div show or hide in visualforce page but page reload when button onclick event
Hi,
i have crated vf page with 6 div section..
$(document).ready(function () {
$('.step2, .step3, .step4, .step5, .step6').hide();
});
function showStep(step_name){
if(is_validate && is_valid){
$('.step, .step2, .step3, .step4, .step5, .step6').hide();
$('.'+step_name).fadeIn();
}
}
<div class"step">
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step2">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step3">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
and so on
when i click the next button vf page reload....
pls help me out
i have crated vf page with 6 div section..
$(document).ready(function () {
$('.step2, .step3, .step4, .step5, .step6').hide();
});
function showStep(step_name){
if(is_validate && is_valid){
$('.step, .step2, .step3, .step4, .step5, .step6').hide();
$('.'+step_name).fadeIn();
}
}
<div class"step">
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step2">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
<div class"step3">
<apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
<apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>
and so on
when i click the next button vf page reload....
pls help me out
Please try to find Javascript error in browser console using "ctrl+shift+j", may be there is some error.
I have tried your code in my developer organization with minor below change, and it works fine. Page was not reload. I have removed "is_validate && is_valid" if condition. and It works fine.
Try it.
Thanks & Cheers,
Jigar