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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:01:38+00:00 2026-05-15T11:01:38+00:00

For some reason, the following bit of code isn’t behaving as I would anticipate

  • 0

For some reason, the following bit of code isn’t behaving as I would anticipate — likely due to a misunderstanding on my end as to how it should behave.

var contentPane = widget.children("div.content").first();

var success = function (content) {
    return function (data, successCode, httpRequest) {
        content.innerHTML = data;
    };
}(contentPane); 

I’ve attached my debugger (well, Firebug anyway) and it looks like ‘content’ on the line content.innerHTML = data; is the Window object, when I should be the result of var contentPane = widget.children("div.content").first();, correct?

Note that if I set a breakpoint before the function, contentPane is indeed set to what I would expect (a jQuery object matching div.content). Whats going on here, what am I missing?

  • 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-15T11:01:39+00:00Added an answer on May 15, 2026 at 11:01 am

    This is what they added $.proxy() for in 1.4 :), like this:

    var contentPane = widget.children("div.content").first();
    
    var success = $.proxy(function (data, successCode, httpRequest) {
                           this.innerHTML = data;
                  }, contentPane);
    

    This just makes the closure declaration for the common case like you have much shorter, $.proxy(function, whatThisIs).


    For the “what’s wrong?” part…nothing, are you sure you’re checking the right variable? this refers to window inside your function, but content is the jQuery object you want…you can see a quick test here: http://jsfiddle.net/vhcde/

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

Sidebar

Related Questions

For some reason the following form isn't submitting the file like it should and
For some reason the following code doesn't work on Windows XP. new URL(file:// +
For some reason, the following code never calls Event::Event(Event&& e) Event a; Event b;
I'm new to Javascript and for some reason I can't get the following code
I'm having trouble understanding the following bit of code that I was hoping would
I have the following bit of code that triggers some ajax events on a
I am using the following code pattern for password validation. For some reason the
For some reason the following doesn't crash like my program does, but I'm pretty
For some reason it looks like constructor delegation doesn't work in the following snippet:
I have a following program but for some reason it is throwing an error

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.