I have written my custom module for Drupal 7. In my page_change.module
file I have only:
<?php
drupal_add_js(drupal_get_path('module', 'page_change') . '/page_change.js');
?>
In my page_change.js
file I have only:
Drupal.behaviors.page_change = {
attach: function (context) {
console.log("text");
}
};
As soon as I enable my module, Drupal doesn't load jquery.js
. It does not even appear in html source in <head>
section. When I disable my module, or delete the only line from page_change.module
file everything works fine.
I have also tried to load my javascript file by adding
scripts[] = page_change.js
In my page_change.info
file (and leaving page_change.module
with only <?php ?>
) but it doesn't seem to work either.
Why does that happen? What am I doing wrong? Am I missing something?
edit: I have even tried to add inline javascript by adding
drupal_add_js('console.log("text");', array('type' => 'inline', 'scope' => 'footer'));
and it writes text
to console, but jquery.js
is still missing.