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 6884017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:27:20+00:00 2026-05-27T05:27:20+00:00

I have a module and in it I add the js with if($_GET[‘q’] ==

  • 0

I have a module and in it I add the js with

if($_GET['q'] == 'workpage') {
drupal_add_js(drupal_get_path('module', 'sb_carousel').'/js/slide.js');
}

problem is it adds it above jqueru which is defined in the .info file. I see there is a ‘weight’ property how do I get my js at the bottom of the js files??

  • 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-05-27T05:27:21+00:00Added an answer on May 27, 2026 at 5:27 am

    You can set the weight by passing an $options array into drupal_add_js():

    $file = drupal_get_path('module', 'sb_carousel').'/js/slide.js';
    $options = array(
      'weight' => 1000, // High number to push this file to the bottom of the list
      'scope' => 'footer' // This will output the JS file in the footer scope, so at the end of the document
    );
    
    drupal_add_js($file, $options);
    

    Using weight and scope you should be able to ensure that your JS file is the very last outputted in the HTML.

    UPDATE

    Just a thought, you mention that your jQuery file is loaded in from an .info file…there’s no need to do that, jQuery is already added in Drupal by default. You can upgrade to jQuery 1.5 with the jQuery Update module but currently there’s no (official) support for any later versions.

    If you’re loading in a second jQuery file it might be what’s causing the problem in the first place, unless you use jQuery.noConflict() properly and even then you might still have problems.

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

Sidebar

Related Questions

So I have a module in flex in which I add a custom component.
In a custom module, I have the following (to add javascript to a particular
I have extended the Mage_Adminhtml_Block_Sales_Order_Grid class with a custom module to add several customer
I have made up the custom module as : YUI.add('util', function(Y) { Y.namespace('com.myCompany'); var
I have started using Dojo's new on module to add my events. It works
I have Excel add-in which I add so many class modules that it is
I have module application. When I run it, the main window of that app
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a module in the parent directory of my script and I would
I have a module that sends an email to a specified email address but

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.