- Add a
scripts = somescript.jsto your module or theme's
drupal_add_js()in your module or theme's code
- Use the
#attached['js']property in a Form API or renderable array.
Note that Drupal already include jQuery, jQuery UI and a bunch of other libraries so you don't, and shouldn't, add them yourself. Instead you should use
drupal_add_library() or the
The Working with CSS guide provides the information to add CSS to Drupal. Again, the techniques presented there apply to both themes and (custom) modules. With an exception: addition of style sheets from an
.info files only works for a theme and not a module.
stylesheets[all] = somestylesheet.cssto a theme's
- Use drupal_add_css() from module or theme's code.
#attached[css]property in a From API or renderable array.
You can place your js file in your theme folder and add this js file to drupal by using
drupal_add_js() in template.php preprocess functions.