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

  • Home
  • SEARCH
  • 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 8414085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:04:51+00:00 2026-06-10T01:04:51+00:00

I am trying to write a script for a dynamic drop down menu as

  • 0

I am trying to write a script for a dynamic drop down menu as a way to learn OOP javascript and jQuery. You can see the dummy site at http://www.industrialMerchants.com/industrialMerchants. The script can be found at http://www.industrialMerchants.com/industrialMerchants/javascript/horizontalDropMenu2.js

The script first defines a number of objects, after which I have a $(document).ready() with a closure designed to initiate the process of wrapping relevant jQuery objects and DOM elements into my object model.

The problem is, when I load the static html document serving as a dummy website, Firebug gives me the following error:

"TypeError: jqObject is undefined."

The error points to the fifth line of the following function.

function Menu(jqObject) {
    self = this;
    this.self = jqObject;
    this.submenus = (function(){
        jqObject.children().children("ul").each(function() { <<--- Error
            submenu = new Submenu($(this), self);
            submenus.push(submenu);
            return submenus;
        });
    }());
}

The lines that call the function are here:

$(document).ready(function(){ 
     menus = new Array();
     $("ul.horizontalDropMenu").each(function(){
         menu = new Menu($(this));
         menus.push(menu);
     });
 });

As you can see, the call to the Menu() object constructor includes as an argument a reference to a jQuery object, so that jqObject clearly IS defined. So what gives?

When I insert breakpoints into the code starting at the $(document).ready() declaration, the execution completely skips it altogether, and starts at the function declaration itself. It’s as if the browser is trying to execute the function declarations before any explicit call to them is made.

  • 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-10T01:04:52+00:00Added an answer on June 10, 2026 at 1:04 am

    Setting a breakpoint and going up the call stack gives me this line (outside .ready – but that doesn’t matter):

    Submenu.prototype = new Menu();
    

    You’re creating a menu instance without a jQuery object but with undefined instead.

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

Sidebar

Related Questions

im trying to write a script , that can rewrites urls in slug way
I'm trying to write a script in jQuery that would iterate through each text
I'm trying to write a script that can be used to restore permissions to
I am trying to learn how to write more dynamic web sites that use
Hopefully someone can help me with this. I'm trying to write a script with
I'm trying to write a script in powershell that i can use to get
I'm trying to write a script that can use a reading frame of 3
I'm newb in powerShell and in cmd, sorry. I'm trying write script that can
I'm trying to write a script which can automatically download gameplay videos. The webpages
I am trying write a script where when a user clicks on a link,

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.