The jQuery dialog box does not appear

advertisements

I have a dialog box that is supposed to pop up if the user is not logged in, and presses the "vote up" link on this page: http://www.problemio.com

I have some JavaScript here: problemio.com/js/problemio.js and I declare that popup in the global variables like this:

var $dialog = $('#loginpopup')
    .dialog({
        autoOpen: false,
        title: 'Login Dialog'
    }); 

var $problemId = $('#theProblemId', '#loginpopup');

$("#newprofile").click(function ()
{
    $("#login_div").hide();
    $("#newprofileform").show();
});

but not exactly sure if the #newprofile code is right, or how to make it global, or whether it can't be global. This confusion stems from me being kind of new at this.

The JavaScript console in Chrome does not show any errors relevant to this, which is even more confusing.

Any ideas on what I might be doing wrong?

Thanks!!


Try using

$("#loginpopup").dialog();

A call to

$(foo).dialog()

will initialize a dialog instance and will auto-open the dialog by default. If you want to reuse a dialog, the easiest way is to disable the "auto-open" option with:

$(foo).dialog({ autoOpen: false })

and open it with

$(foo).dialog('open')

. To close it, use

$(foo).dialog('close')

jQuery UI Dialog