Here is my jQuery:

<script type="text/javascript">
        $(document).ready(function(){
           $('[id$=_questions],[id$=_questionsLink]').hide();
        $('[id$=_y]').bind('click',function(){
           var thiis = $(this).attr('id').charAt(1);
           $('#'+thiis+'_questions').show();
           $('#'+thiis+'_questionsLink').show();
           });
        $('[id$=_n]').bind('click',function(){
           var thiis = $(this).attr('id').charAt(1);
           $('[class$=_condition]').val("");
           $('[id$=_date]').find('option:first').attr
('selected','selected').parent('select');
           $('#'+thiis+'_questions').hide();
           $('#'+thiis+'_questionsLink').hide();
           });
        $('[id$=toggle]').bind('click',function(){
           var thiis = $(this).attr('id').charAt(0);
           $('#'+thiis+'_questions').toggle();
           $(this).val($(this).val() == 'hide additional questions' ? 'show
additional questions' : 'hide additional questions');
           });
});
</script>


Here is the code for the first question:

<table class="gray">
              <tr>
                <td colspan="3"><strong>1.</strong> Have you ever had
symptoms, been diagnosed with, or been treated for:</td>
              </tr>
              <tr>
                        <td class="subQuestion" width="700px;"><label 
for="1a"><strong>a.
                        </strong> High Blood Pressure</label> <span
id="a_questionsLink"><input
                                type="button" id="a_toggle" value="hide 
additional questions"
                                style="font-size:10px; float:right;" 
/></span></td>
                        <td style="white-space:nowrap;width:54px;"><label>
                  <input type="radio" name="1a" value="yes" id="1a_y"/
>
                  Yes</label>
                </td>
                <td style="white-space:nowrap;width:54px;"><label>
                  <input type="radio" name="1a" value="no" id="1a_n"/>
                  No</label>
                </td>
              </tr>

              <tr id="a_questions">
                <td colspan="3" align="center" style="background-
image:none">
                        <table class="yesTable" cellpadding="0"
cellspacing="0">
                        <tr bgcolor="#e2e2e2">
                            <td>Disease, Injury, or Medical Condition?
</td>
                            <td>Treatment, Medication, Dosage?</td>
                            <td>Date Treatment Began?</td>
                            <td>Date Treatment Ended?</td>
                        </tr>
                  <tr height="50px;">
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a1"/></td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a2"/></td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a3"/></td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a4"/></td>
                        </tr>
                  <tr bgcolor="#e2e2e2">
                                <td>Was Individual Hospitalized?</td>
                            <td>Attending Physician?</td>
                            <td>Physician Phone Number?</td>
                            <td>Degree of Recovery?</td>
                        </tr>
              <tr height="50px;">
                                <td height="20px;">
                                <input type="radio" name="1a5"
value="yes" class="1a_yes"/>Yes
                                <input type="radio" name="1a5"
value="no" class="1a_no"/>No
                            </td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a6"/></td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a7"/></td>
                            <td height="20px;"><input type="text"
class="1a_condition" name="1a8"/></td>
                        </tr>
                    </table>
                  </td>
              </tr>


On Sep 9, 12:22 pm, "Cesar Sanz" <the.email.tr...@gmail.com> wrote:
> Well, can you show us some mark-up?
>
> ----- Original Message -----
> From: "the intern" <aaron.wal...@urs.org>
> To: "jQuery (English)" <jquery-en@googlegroups.com>
> Sent: Tuesday, September 08, 2009 1:54 PM
> Subject: [jQuery] Page load question
>
> > What I have is a form where people will answer yes or no questions.
> > What I need is, that when the page is loaded, a way to go though the
> > questions and check to see which ones are marked as yes. The reason
> > for this is, when yes is checked, there are additional questions that
> > open up using .show(). Right now, if the page is refreshed or
> > reloaded, all the additional questions hide regardless if the yes is
> > check or not.
>
> > Thanks in advance
>
> > Aaron

Reply via email to