This question is really using a jQuery dialog to ask a more generic jQuery question.
I need to, in essence, pass a continuation to a modal jQuery dialog.
I want to define a dialog box once on a page, but when calling dialog('open') on it, I want to arrange for the button functions in the dialog to have a value in scope that they can call back.
Given:
var $dialog = $('<div></div>')
.html('Is this text correctly segmented?')
.dialog({
autoOpen: false,
modal: true,
title: 'Correct?',
buttons: { "Yes": function() { $(this).dialog("close");
},
"No": function() { $(this).dialog("close");
}
});
could it be as simple as declaring some other var, referencing it in the button functions, and setting it before opening?