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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:45:25+00:00 2026-06-05T10:45:25+00:00

I have the following code: var dp = dp || { VERSION : ‘0.00.02’,

  • 0

I have the following code:

var dp = dp || {
    VERSION : '0.00.02',
    startApp : function() {
        $(app.init);
        $(app.start);
    }
};
dp.startApp();

which calls app.init and app.start below:

var app = app || {};

app.init = function() {
    this.baseElement = $('div#app');
    $('body').css('background-color', 'beige');
};

app.start = function() {
    //this.baseElement.html('showing this'); //this works
    //this.show(); //error: show is not a function
    app.show(); //error: show is a function, but baseElement is undefined
};

app.show = function() {
    this.baseElement.html('showing this');
};

why in app.start does:

  • the first line work
  • the second line show it is not a function
  • the third line say that baseelement is undefined
  • 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-05T10:45:26+00:00Added an answer on June 5, 2026 at 10:45 am

    Since you are passing the functions to document.ready, jQuery will call them with this set to document. That means you can set arbitrary properties on document of course, but it’s not a jQuery object so it doesn’t have the methods you are calling.

    You can try this:

    $(dp.startApp) //Since `this` doesn't matter here
    

    and

    startApp : function() {
        app.init(); //Calling the functions as property of `app`, will make `this` set to `app`
        app.start();
    }
    

    I guess the biggest thing you are missing here is that the binding of this is dynamic and is determined by the way you call functions, not how you define them.

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

Sidebar

Related Questions

I have the following jquery code: $(function() { $('.sliding-buttons').click(slidingContent); }); function slidingContent(e) { var
I have the following code to build a project from another C# app: var
Below, is a simplified version of my App , the following code works as
I have the following code: var sl: THashedStringList; begin sl:= THashedStringList.Create; sl.Duplicates := dupIgnore;
I have the following code: var bool:String = true; Without an if block or
I have the following code: var GoalPanelView = Backbone.View.extend({ // Bind to the goal
I have the following code: var tlp = new TableLayoutPanel { Location = new
I am using ASP.NET 3.5 with iTextSharp and I have the following code: var
Right, starting to go crazy here. I have the following code: var query =
I Have following code with LINQ var q = (from web in DataContext.Webs select

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.