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' => 'container', '#states' => array( // Hide the settings when the cancel notify checkbox is disabled. 'invisible' => array( ':input[name="email_canceled_toggle"]' => array('checked' => FALSE), ), ), );