Skip to main content
Tweeted twitter.com/#!/StackDrupal/status/393582224865783808
improved formatting
Source Link
Bala
  • 5.2k
  • 6
  • 24
  • 40

What is the difference between drupal_add_js() and $form['#attached']['js'][] ?
When is the purpose of using each of the above functions?
  

(I mean I know that it is used to attached js to say form if used inside form but when is drupal_add_jsdrupal_add_js used and when is $form['#attached']['js'][]$form['#attached']['js'][] used ?)

What is the difference between drupal_add_js() and $form['#attached']['js'][] ?
When is the purpose of using each of the above functions?
 (I mean I know that it is used to attached js to say form if used inside form but when is drupal_add_js used and when is $form['#attached']['js'][] used ?)

What is the difference between drupal_add_js() and $form['#attached']['js'][] ?
When is the purpose of using each of the above functions?
 

(I mean I know that it is used to attached js to say form if used inside form but when is drupal_add_js used and when is $form['#attached']['js'][] used ?)

Source Link
harshal
  • 4.4k
  • 6
  • 41
  • 82

what is the difference between using drupal_add_js and ['#attached']

What is the difference between drupal_add_js() and $form['#attached']['js'][] ?
When is the purpose of using each of the above functions?
(I mean I know that it is used to attached js to say form if used inside form but when is drupal_add_js used and when is $form['#attached']['js'][] used ?)