Toggle text field depending on checkbox value in drupal 6 I need to toggle a textbox depending upon the checkbox value.

Basically i need to take email entries for updates. 

Here is the form elements I used.

$form['chkupdates'] = array(
        '#type' =&gt; 'checkbox',
        '#title' =&gt; t('Sign up to receive email updates about Green Apple'),
        '#options' =&gt; array(
        '1' =&gt; t('Yes'),
        '0' =&gt; t('No')
        ),
        '#default_value' =&gt; FALSE,
        '#attributes' =&gt; Array('class'=&gt;'sub-form-element',
        'id'=&gt;'chkbox'),
);

$form['chkmail'] = array(
'#type' =&gt; 'textfield',
'#title' =&gt; t(''),
'#attributes' =&gt; Array('class'=&gt;'field','id'=&gt;'chktext'),
);


Please guide.I am rendering elements in tpl files so jQuery is acceptable. 
Thanks
You could do something along these lines:

$('#CHKBOX').click( function() {

  if ($('#CHKBOX').is(':checked')) {
    $('#CHKTEXT').display();
  } else {
    $('#CHKTEXT').hide();
  }

});


where CHKBOX and CHKTEXT are the CSS ids of the form elements in the resulting HTML.  If you know it will be hidden at the start, this can be simplified further into:

$('#CHKBOX').click( function() {
  $('#CHKTEXT').toggle();
});