Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show/hide radio buttons based on checkbox state
Message
From
28/01/2014 12:26:12
 
 
To
28/01/2014 12:14:33
General information
Forum:
Javascript
Category:
JQueryUI
Miscellaneous
Thread ID:
01592468
Message ID:
01592494
Views:
31
Have you checked the source in the browser to verify that the Id is correctly translated to 'AHYSChk01' ?

Might be safer to use a class to identify it. e.g: input type='checkbox' class='chk' .... and then:
$('.chk').click(function () { //etc});
>
>td>
>   input type="checkbox" name="py_PY_AHYS_NIE<<ch>>" id="AHYSChk<<ch>>" <<IIF(llPY_AHYS_NIE, [ CHECKED], [])>> >AHYS  
>   input type="checkbox" name="py_PY_AHYL<<ch>>" id="AHYLChk<<ch>>" <<IIF(llPY_AHYL, [ CHECKED], [])>> >AHYL
>/td>
>td>
>div id = "YSElig<<ch>>" style="display:none">
>   input type="radio" name="py_SpElig_Type<<ch>>" value="SP" <<iif(lnPY_EligType=1,"checked","")>>/><b>AHYS SUB+Spouse</b>
>   input type="radio" name="py_SpElig_Type<<ch>>" value="SUB" <<iif(lnPY_EligType=2,"checked","")>>/><b>AHYS SUB Only</b>
>/div>
>div id = "YLElig<<ch>>" style="display:none">
>   input type="radio" name="py_YLElig_Type<<ch>>" id="YLElig1<<ch>>" value="SP" <<iif(lnPY_YLEligType=1,"checked","")>>/><b>AHYL SUB+Spouse</b>
>   input type="radio" name="py_YLElig_Type<<ch>>" id="YLElig2<<ch>>" value="SUB" <<iif(lnPY_YlEligType=2,"checked","")>>/><b>AHYL SUB Only</b>
>/div>
>
>
>Variables are defined above this section, of course
>
>And, again, the functions are:
>
>
>
>                      <!-- jQuery Script to hide/show radio buttons -->
>                      <script type="text/JavaScript" Language = "JavaScript">
>                       
>                        $("#AHYSChk<<ch>>").click(function()
>                           {
>	                         if $('#AHYSChk<<ch>>').is(':checked')
>
>	                            { $('#YSElig<<ch>>').show(); 
>	                            }	
>	                         else
>	                            { $('#YSElig<<ch>>').hide(); 
>	                            }
>                           }
>                         
>
>
>
>
>
>
>>>>Probably the fact the :ischecked should be in quotes:
if ($'#AHYSChk01').is(':checked'))
>>>
>>>Apparently, it's not recognizing the 'onclick' routine.
>>
>>So what's the html for the element with the 'AHYSChk01' Id ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform