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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:46:04+00:00 2026-05-23T11:46:04+00:00

Here’s a sample of my structure: this.is.a.really.long.namespace = { inputs : {}, buttons :

  • 0

Here’s a sample of my structure:

this.is.a.really.long.namespace = {

    inputs : {},
    buttons : {},
    panels : {},

    fn : {

        abc : function() {},
        def : function() {}

    } 

};

Now, as you can see I’m storing my inputs, buttons, panels, and functions in their own respective object literals. The issue lies within fn.abc, fn.def, or any other function inside of page.fn. I want to be able to access my inputs, buttons, and panels from within the functions inside of fn.

Obviously, I know I can type this.is.a.really.long.namespace.inputs, but as you can see, that’s pretty long, and I don’t want to have to type it out for every single instance where I need to reference an object within the page.

Is there not a way I can directly reference inputs, buttons, and panels from within fn?

I was thinking I could do:

fn : {

    that : this.is.a.really.long.namespace,

    abc : function() {},
    def : function() {}

}

which would allow me to use that.inputs inside of fn.abc, but is there a concern with that method? Any sort of overhead I need to be aware of? Or is there a better way to accomplish this?

  • 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-23T11:46:05+00:00Added an answer on May 23, 2026 at 11:46 am

    Ok … Here’s what I ended up doing:

    this.is.a.really.long.namespace = {
    
        inputs  : { firstName : undefined },
        buttons : { submit : undefined },
    
        fn : {
    
            root : undefined,
    
            abc : function() { console.log(this.root.inputs.firstName); },
            def : function() { console.log(this.root.buttons.submit); }
    
        },
    
        init : function() {
    
            var self     = this,
                fn       = self.fn,
                inputs   = self.inputs,
                buttons  = self.button;
    
                fn.root  = this;  // this is the key
    
                inputs.firstName  = $("#first-name");
                buttons.submit    = $("#submit-button");
    
            fn.abc();
            fn.def();
    
        }
    
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here's a coding problem for those that like this kind of thing. Let's see
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here's my function: static Map AddFormation(Map _map, Tile tile, int x, int y, int
Here is my javascript code for a cursor focus function to go to username
Here is what I want to do. Use this HTML line and have the
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here is my code sample, let me know if it can be further improved?
Here is what I am trying to achieve in PHP: I have this string:

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.