Dynamically hiding / showing Field API fields in Drupal 7
In Drupal 7 you can use $form #states instead of custom jQuery script. Example:

  $form['student_type'] = array(
    '#type' =&gt; 'radios',
    '#options' =&gt; array(
      'high_school'   =&gt; t('High School'),
      'undergraduate' =&gt; t('Undergraduate'),
      'graduate'      =&gt; t('Graduate'),
    ),
    '#title' =&gt; t('What type of student are you?')
  );

  // High school information.
  $form['high_school']['tests_taken'] = array(
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; drupal_map_assoc(array(t('SAT'), t('ACT'))),
    '#title' =&gt; t('What standardized tests did you take?'),
    // This #states rule says that this checkboxes array will be visible only
    // when $form['student_type'] is set to t('High School').
    // It uses the jQuery selector :input[name=student_type] to choose the
    // element which triggers the behavior, and then defines the "High School"
    // value as the one that triggers visibility.
    '#states' =&gt; array(
      'visible' =&gt; array(   // action to take.
        ':input[name="student_type"]' =&gt; array('value' =&gt; 'high_school'),
      ),
    ),
  );


Here is example if you want to use #states for multiple values condition:

 $form['student_type'] = array(
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; array(
      'high_school'   =&gt; t('High School'),
      'undergraduate' =&gt; t('Undergraduate'),
      'graduate'      =&gt; t('Graduate'),
    ),
    '#title' =&gt; t('What type of student are you?')
  );

  // High school information.
  $form['high_school']['tests_taken'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('What standardized tests did you take?'),
    '#states' =&gt; array(
      'visible' =&gt; array(   // action to take.
        ':input[name="student_type[high_school]"]' =&gt; array('checked' =&gt; TRUE),
        ':input[name="student_type[undergraduate]"]' =&gt; array('checked' =&gt; TRUE),
        ':input[name="student_type[graduate]"]' =&gt; array('checked' =&gt; FALSE),
      ),
    ),
  );


See the form_example/form_example_states.inc from examples module for more details and examples.