Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:52:01+00:00 2026-06-05T22:52:01+00:00

I am writing a module for Drupal 7, that has 3 submodules. All submodules

  • 0

I am writing a module for Drupal 7, that has 3 submodules. All submodules have their own module, style and js files.
In the init function of each submodule I include all javascript files that module uses:

  drupal_add_js(path);

Everything works fine except jQuery. I tried different ways:

  (function ($) {
     alert("1");    
  })(jQuery);

  alert(jQuery('div'));
  alert($('div'));

and nothing happening.
Tried to use jQuery as inline function in my module file:

  drupal_add_js("(function ($) {alert('1');})(jQuery)","inline");

it doesn’t work too.

Week before everything worked fine, even popup menus and ajax, based on jQuery. But then I rewrote php functions, add functionality and optimized queries(I haven’t modified js files that worked correctly). Maybe I have changed some server configuration files too(I use Denver and run project on localhost).

Only now I realized that my jQuery doesn’t work, I have tested everything, spent already 2 days searching for an answer. I know that I made some silly and simple mistake but I can’t find where it is. Maybe someone already had such problem, help please.

P.S.: it’s my 1-st post here, please don’t judge me too harshly

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:52:02+00:00Added an answer on June 5, 2026 at 10:52 pm

    I would disable js aggregation (if enabled), then check the source code to see if the path to those JS files are correct. If so, I would use Drupal.behaviours around your js as described here http://drupal.org/node/756722#behaviors If that doesn’t work, I would check if there are no js errors popping up somewhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a module that has multiple questions users can chose to answer. Each
I'm writing a Drupal module that deals with creating new nodes from CSV files.
I'm writing a module that has some functions dealing with text files. I'm new
I'm writing a module that has several methods. Let's consider this : package MyPackage;
I am writing a drupal module that involves a form with many checkboxes. E.g.
I made a private section on a drupal site by writing a module that
Quick background: writing a module. One of my objects has methods that may or
I'm writing my own Drupal 7 module, and like to use JQuery in it.
I'm writing a module in Drupal-7 that dynamically sends a one-time login link to
I'm writing a Drupal 6 module that sends a user ID + a randomly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.