diff --git a/conditional_fields.module b/conditional_fields.module
index 58a8374..714093c 100644
--- a/conditional_fields.module
+++ b/conditional_fields.module
@@ -631,7 +631,7 @@ function conditional_fields_form_after_build($form, &$form_state) {
     return $form;
   }
 
-  $form['#attached']['js'][] = drupal_get_path('module', 'conditional_fields') . '/js/conditional_fields.js';
+  drupal_add_js(drupal_get_path('module', 'conditional_fields') . '/js/conditional_fields.js');
 
   // Add effect settings to the form.
   if ($effects) {
