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 15:24:51
 
 
General information
Forum:
Javascript
Category:
JQueryUI
Miscellaneous
Thread ID:
01592468
Message ID:
01592506
Views:
41
Yes, yes I have...and yes it is.

>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});
I thought of that, but wouldn't that do the same thing to ALL the checkboxes on the form?


>
>
>
>>
>>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 ?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform