A Popup Dialog Box for jQueryMobile
When writing functions for each button, there are a number of widget methods available to you. They are all available in the keyword "this", which I prefer the convention of assigining to "self". e.g.:
jQuery$(document).delegate('#opendialog', 'click', function() { // NOTE: The selector is the hidden DIV element. $('#inlinecontent').simpledialog2({ ... button: { 'ok': { 'click': function () { var self = this; } ....
Inside the self object, you will find the following:
A jQuery object that contains the calling element
An integer definition used by this dialog. Used for cleanup and event namespacing
A object that contains all the calling options (or the default)
A jQuery object that contains "screen", or full page element that sits behind the dialog - it can either fade the background, or just catch clicks outside the dialog
A jQuery object that contains the HTML of the body of the dialog (and the header in popup/fullscreen mode). You can change this directly, but it is here for search / replace operations really.
A variable that contains the value of the buttonInput field.
Closes (and destorys) the dialog.
Takes 1 argument, the new HTML for a currently open 'blank' mode dialog.
Force the dialog to re-calculate it's on-screen position.
The first argument (you can name it if you like), is the event that was called. Not sure why this might be helpful, but it is there.
These can be set with the 'args' property - you can name them too if you like.