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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:53:44+00:00 2026-05-30T18:53:44+00:00

I come from an ExtJS background and am slowly learning jQuery. I am trying

  • 0

I come from an ExtJS background and am slowly learning jQuery. I am trying to access the value of an option/property I added myVar to a Dialog from the open event of the dialog.

$("#add-family-dialog").dialog({
    autoOpen: true,
    height: 450,
    width: 600,
    resizable: false,
    modal: true,
    myVar: "hello world!",
    open: function(event, ui) { 
        // TODO: get the myVar value
        // this
        alert($(this).myVar);
        // or this
        alert($(this).attr("myVar"));
        // or this
        alert(this.myVar);
    }
});

How can I access myVar‘s value? Is this the correct way to do this or is there a better method of holding variables on an object?

  • 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-30T18:53:45+00:00Added an answer on May 30, 2026 at 6:53 pm

    You can access it through the 'option' method:

    var myVar = $(this).dialog('option', 'myVar');
    

    Demo: http://jsfiddle.net/ambiguous/ww5Gm/

    I don’t know if this is specified or accidental behavior though so I wouldn’t depend on it. A more natural approach (IMO) would be to use data to attach your extra data:

    $('.dialog').data('myVar', 'hello world!').dialog({
        // ...
        open: function(event, ui) {
            var myVar = $(this).data('myVar');
            // ...
    

    Demo: http://jsfiddle.net/ambiguous/R9z8D/

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

Sidebar

Related Questions

I come from a Java background and I am now trying to study PHP
I come from a mostly n-tier background, and I'm trying to move more towards
I come from a Java/C++ OOP background and am trying to get into JavaScript
I come from a C# background and I am learning Objective-C. I was wondering
I come from a background of 1 year programing in html/css/javascript/jQuery and 6 months
I come from a Java background, where packages are used, not namespaces. I'm used
I come from a mainly PHP background and make good use of the Apache
I come from a CVS background. I'm currently investigating using SVN for a project.
I come from a background of MoM. I think I understand ESB conceptually. However,
I come from classes object orientation languages and recently I have been learning those

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.