Drupal - Adding Javascript to your module

When creating your own Drupal module, you may need to add some styling or Javascript to improve the usability of your module. Here is how to do it.

drupal_add_js(drupal_get_path('module', 'MODULE_NAME') . '/common.js');

Similarly you can add CSS to your module as well

drupal_add_css(drupal_get_path('module', 'MODULE_NAME') . '/styles.css');

1 comments for Drupal - Adding Javascript to your module

Brian's picture

Thanks for sharing this....

Thanks for sharing this.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.