You need to sign in to do that
Don't have an account?
dou
Javascript : show/hide some div associated with radio buttons in a visualforce page
Hello,
I have a probleme with javascript and a visualforce page so I need your help ;)
I have some radio buttons, and each have an id, I want that when I click on one button, a div appears in my visualforce page (I have 3 button and 3 div, corresponding to each button)
Here is my code, but obviosly it did not work :
I would like that my 3 div are hiden by default, and when i click a radio button the div associated are display...
Thank you !
I have a probleme with javascript and a visualforce page so I need your help ;)
I have some radio buttons, and each have an id, I want that when I click on one button, a div appears in my visualforce page (I have 3 button and 3 div, corresponding to each button)
Here is my code, but obviosly it did not work :
<apex:form > <apex:selectRadio value="{!livraison}" layout="pageDirection" id="radios"> <apex:selectOption id="a" itemLabel="{!$Label.EXT_LIVRAISON_TRANSPORTEUR}" itemValue="{!$Label.EXT_LIVRAISON_TRANSPORTEUR}"/> <apex:selectOption id="b" itemLabel="{!$Label.EXT_ENLEVEMENT_LABO}" itemValue="{!$Label.EXT_ENLEVEMENT_LABO}"/> <apex:selectOption id="c" itemLabel="{!$Label.EXT_CMD_JOINDRE_CONSEILLERE}" itemValue="{!$Label.EXT_CMD_JOINDRE_CONSEILLERE}"/> </apex:selectRadio> </apex:form> </div> <script type="text/javascript"> $(document).ready(function() { //hide the 3 div $('#diva').hide(); $('#divb').hide(); $('#divc').hide(); }); $('[id$=a]').change(function() { if(this.checked) { $('#diva').show(); $('#divb').hide(); $('#divc').hide(); } }); $('[id$=b]').change(function() { if(this.checked) { $('#divb').show(); $('#diva').hide(); $('#divc').hide(); } }); $('[id$=c]').change(function() { if(this.checked) { $('#divc').show(); $('#diva').hide(); $('#divb').hide(); } });My 3 radio button are working (i can check them), but not the divs.
I would like that my 3 div are hiden by default, and when i click a radio button the div associated are display...
Thank you !
Check the answer in this (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BQ3jIAG)post for an example.
Thank you