Question: Is there a way to set descriptions to each checkbox option? What I would like is for Option #1 to display and then directly below it a description for it, then Option #2 along with its description.
I have:

```
 $form['field_options'] = array(
                    '#type' => 'checkboxes',
                    '#options' => array(
                        0 => t('Option #1'),
                        1 => t('Option #2')),
                    '#title' => t('Select Options'),
                    '#description' => t('Entering a description here will display below the last item in the array'),
                    '#default_value' => array(0)
            );

```

Also, for some reason `$form_state['values']['field_options']` in function `hook_node_submit()` shows

```
Array
(
    [0] => 0
    [1] => 0
)

```

shouldnt it show what the states of the checkboxes are like this?:

```
Array
(
    [0] => 1
    [1] => 0
)

```

Thanks

Answer: 
First of all you need to call `drupal_add_js()` with a 'settings' parameter. This will inform your Drupal.settings javascript namespace about the settings/variables you need in this file via drupal. Try the following :

Lets suppose you want to call a specific \*.js file on a nodes' view page, call it as :

```
drupal_add_js(array('myModule' => array('basepath' => '<your-drupal-base-path>')), 'setting');

```

This `basepath` is global and you can get it in any \*.js file called at this point. Next, you can use this `basepath` in your \*.js file as :

```
var path = Drupal.settings.myModule.basepath;

```
To get the path on js file like following: 

```
var path = Drupal.settings.myModule.basepath;

```

First need to initiate add\_drupal\_js() with 'settings' parameter like : 

```
drupal_add_js(array('myModule' => array('basepath' => '<the-path>')), 'setting'); 

```

Example: 

```
drupal_add_js( array( 
   'myModule' => array(
             'basepath' => drupal_get_path('module', 'myModule')
              )
    ), 'setting' 
);

```

Then on any \*.js file you can access this variable as following: 

```
 (function ($) {
      Drupal.behaviors.myModule= {
        attach: function (context, settings) {
          // You can access the variable by using var 
          path = Drupal.settings.myModule.basepath;
          console.log(Drupal.settings.myModule.basepath);

        }
      };
    }(jQuery));

```