How do I show or hide texbox based on radiobuttonlist selection
<p>I honestly thought this was simple.</p>

<p>I have a radioButtonList with two values, Approved or Rejected.</p>

<p>If the selected Value is Approved, hide the texbox. If rejected is selected, then show the textbox so reasons for rejection could be entered into the box.</p>

<p>I can't get this to work. I tried:</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
    $(document).ready(function () {
        $('input:[name=&lt;%= apr_rej.ClientID %&gt;]').click(function () {
            if ($(this).val() == 'Approved') {
                $('#&lt;%= divReason.ClientID %&gt;').hide();
            } else {
                $('#&lt;%= divReason.ClientID %&gt;').show();
            }
        });
    });
&lt;/script&gt;
</code></pre>

<p>I got divReason must be declared.</p>

<p>Then I tried:</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
    $(document).ready(function () {
        $('input:[name=&lt;%= apr_rej.ClientID %&gt;]').click(function () {
            if ($(this).val() == 'Approved') {
                $('#divReason').hide();
            } else {
                $('#divReason').show();
            }
        });
    });
&lt;/script&gt;
</code></pre>

<p>No errors but not event fired.</p>

<p>Here is the markup:</p>

<pre><code>       &lt;tr&gt;
         &lt;td align="left" class="style1" style="border: thin solid #6699FF"&gt;
             &lt;h3 style="text-align: left"&gt;
                 2.&lt;strong&gt; Select One:&lt;/strong&gt;&lt;/h3&gt;
           &lt;/td&gt;
            &lt;td style="border: thin solid #6699FF" class="style5"&gt;&lt;asp:RadioButtonList runat="server" 
                    ID="apr_rej" repeatdirection="Horizontal" TextAlign="Left" CellPadding="0" 
                    CellSpacing="0" style="font-weight:700; text-align: center;" 
                    Height="21px" Width="406px" &gt;
                    &lt;asp:ListItem Text="Approve" Value="Approved" /&gt;
                    &lt;asp:ListItem Text="Reject" Value="Rejected" /&gt;
               &lt;/asp:RadioButtonList&gt;
           &lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr id="divReason"&gt;
          &lt;td align="left" class="style3" style="border: thin solid #6699FF"&gt;
             &lt;h3 class="style4"&gt;
3. Enter Comments:&lt;/h3&gt;
          &lt;/td&gt;
          &lt;td style="border: thin solid #6699FF;font-Weight:bold;" class="style5"&gt;Comments:(If this form is Rejected, you must give a reason.)&lt;br /&gt;
              &lt;asp:TextBox id="txtreason" runat="server" TextMode ="MultiLine" 
                 style="border: 1px solid #6699FF" BorderColor="White" Height="114px" 
                  Width="574px"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;
         &lt;/td&gt;
      &lt;/tr&gt;
</code></pre>

<p>Not sure what I am doing wrong.</p>
