Alright, I didn't know you had different id's for the other elements
too.  Ok there are a couple of things you can do.  One, obviously, is
doing it like you currently are, with many lines of code per
element :)
Here are my thoughts to make it dynamic.

$(document).ready(function(){
               $('#questions,#questionLink').
hide();
      $('[id$=_y]').live('click',function(){
               var thiis = $(this).attr('id').charAt(0);
               $('[id$=thiis]').show();
               $('#1a_y').checked(true);
               return false;
               });
       $('[id$=_n]').live('click',function(){
               var thiis = $(this).attr('id').charAt(0);
               $('[id$=thiis]').hide();
               $('#1a_n').checked(true);
               return false;
               });
       $('#toggle1a').click(function(){
               $('#questions').toggle();
               return false;
               });
});



Copying this code as is, your hide/show should work for all of your
checkboxes or whatever it is for.  I haven't touched the "$
('#1a_y').checked(true);" lines, or the toggle stanza, but you should
be able to come up with something following the same logic.

If any of that doesn't make sense or you just want me to explain my
thought process, lemme know.  I am always happy to help.

~ross


On Aug 25, 4:39 pm, the intern <[email protected]> wrote:
> I gave that a try and it did not work for me. When I would click on
> the first yes radio button, the hidden portion for all would show up.
>
> Here is the jQuery code for question 1 and 2 together. As you can see,
> it is the same basic code. But the id is different:
>
> <script type="text/javascript">
> $(document).ready(function(){
>                 $('#questions,#questionLink').hide();
>         $('#1a_y').click(function(){
>                 $('#questions').show();
>                 $('#questionLink').show();
>                 $('#1a_y').checked(true);
>                 return false;
>                 });
>         $('#1a_n').click(function(){
>                 $('#questions').hide();
>                 $('#questionLink').hide();
>                 $('#1a_n').checked(true);
>                 return false;
>                 });
>         $('#toggle1a').click(function(){
>                 $('#questions').toggle();
>                 return false;
>                 });
>
> });
>
> $(document).ready(function(){
>                 $('#questions2,#questionLink2').hide();
>         $('#1b_y').click(function(){
>                 $('#questions2').show();
>                 $('#questionLink2').show();
>                 $('#1b_y').checked(true);
>                 return false;
>                 });
>         $('#1b_n').click(function(){
>                 $('#questions2').hide();
>                 $('#questionLink2').hide();
>                 $('#1b_n').checked(true);
>                 return false;
>                 });
>         $('#toggle1b').click(function(){
>                 $('#questions2').toggle();
>                 return false;
>                 });});
>
> </script>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to