Make a from element visible when a radio button is clicked I have a problem to make a date and a list element in a form in HTML invisible if the user selects one way, and visible if the user selects two. How can I write the JavaScript code for that?
No need to write JavaScript for that; if you are working in PHP, you can use #states on the form element.

Example: form_example_states_form.

  $form['high_school'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('High School Information'),

    // This #states rule says that the "high school" fieldset should only
    // be shown if the "student_type" form element is set to "High School".
    '#states' =&gt; array(
      'visible' =&gt; array(
        ':input[name="student_type"]' =&gt; array('value' =&gt; 'high_school'),
      ),
    ),
  );