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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:30:02+00:00 2026-06-03T02:30:02+00:00

Is there a global reference to the widget itself once it’s been created using

  • 0

Is there a global reference to the widget itself once it’s been created using the jQuery UI widget factory pattern?

I’ve tried doing things like setting a widget var equal to the widget:

$.widget("my.widget", {
  _widget: this,
  _create: function () {
    // _widget should == the whole widget
  }
});

I’ve also tried grabbing the context of the widget through jQuery like:

$.widget("my.widget")

I can’t figure out how you’re supposed to be able to call back to the widget, while inside of the widget.

  • 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-03T02:30:03+00:00Added an answer on June 3, 2026 at 2:30 am

    Whilst inside a widget method you refer to the instance via the ‘this’ keyword:

    $.widget('my.widget', {
        foo: true,
        _create: function () {
            var foo = this.getFoo();
        },
        getFoo: function () {
            return this.foo;
        }
    
    });
    

    If you’re in a method and find that the context has changed (as is often the case when writing jQuery) then you can just store a reference to ‘this’ in a local var:

    $.widget('my.widget', {
        foo: true,
        _create: function () {
            var self = this;
            this.element.click(function () {
                var foo = self.getFoo();
            });
        },
        getFoo: function () {
            return this.foo;
        }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to handle the application_start event without using the global.asax? The
Is there a way to get around having to reference Global variables inside a
Does C# have a typedef for reference types? I know that there's a using
Does C# have a typedef for reference types? I know that there's a using
Is there anything similar to global variable in SSIS? I have 4 variables (FromAddress,
Is there a way to register for global mouse moved events in Cocoa? I
Is there a way to have different Global Configurations for each section of articles?
Is there an event that I can tap into in Global.asax to execute some
In Ruby is there any method that lists all the global variables available at
in a form if there is a field and a global error both messages

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.