This question already has an answer here:

I've added my.js using js injector module and updated .info file. Where do I have to create those instances? Sorry, I'm new with technology.

marked as duplicate by Mołot, Pierre.Vriens, Adrian Cid Almaguer, Clive Feb 19 '16 at 14:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


To Add any js file to your Drupal site , a good way is to create a custom module and add your js file there.Following points may help you.

  • Create one custom module of yours. Useful Link. https://www.drupal.org/developing/modules/7
  • In your module , create one folder name js.
  • Add your js file here.You can copy paste your js file also here.
  • Now in yourmodule file the following code to tell drupal about your js file.

    function YOURMODULENAME_init(){
     drupal_add_js(drupal_get_path('module', 'YOURMODULENAME') . '/js/yourjs.js');
  • At the end enable your custom module.You are ready to go.

Not the answer you're looking for? Browse other questions tagged or ask your own question.