How can I make a field appears when you check on a checkbox? I'm making a module and on the administration page there is a form and I want to make one of the fields appears only when user check on a checkbox. Like the option to add a new content to a menu.
You can use #states from FormAPI that drupal provides.
Below is the link
https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#states

Below is the code from drupal form api

$form['email_canceled']['settings'] = array(
    '#type' =&gt; 'container',
    '#states' =&gt; array(
      // Hide the settings when the cancel notify checkbox is disabled.
      'invisible' =&gt; array(
       ':input[name="email_canceled_toggle"]' =&gt; array('checked' =&gt; FALSE),
      ),
    ),
  );