The jQuery dialog box does not appear


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:

I have some JavaScript here: and I declare that popup in the global variables like this:

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

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

$("#newprofile").click(function ()

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?


Try using


A call to


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


. To close it, use


jQuery UI Dialog