Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Adding JavaScript and variables through a module

Video loading...

Transcript language code: 

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:15
    So the basic way that we add JavaScript in Drupal
  • 0:19
    is with a function called drupal_add_js.
  • 0:22
    And we can find it over here on
  • 0:26
    Just start typing Drupal add js, there it is, comes right up.
  • 0:35
    So drupal_add_js is sort of a generalized function, which
  • 0:40
    allows you to add JavaScript in several different ways
  • 0:43
    onto the Drupal page.
  • 0:46
    We're looking at the Drupal 6 version of the function,
  • 0:49
    because our module's a Drupal 6 module.
  • 0:51
    We'll talk about some Drupal 7 JavaScript implementations

Adding Javascript and Variables Through a Module


Shows how to pass variables from the PHP and Drupal side over to the front-end JavaScript scripts that are running so that you can use the Drupal interface to create customized settings that will appear in your jQuery scripts.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.