Hi
I'm struggling to implement this. This is what I have done so far
Added a html component on my page with the following code (copied from above)
--------------------------------------------------------------------------------------------------
[url=http://#]OK[/url]
[url=http://#]NO[/url]
[url=http://#]Cancel[/url]
--------------------------------------------------------------------------------------------------
add a js script file with the following code (also from above)
--------------------------------------------------------------------------------------------------
function MessageDialog( caption, title, text, options ){
function closePopup( next ){
return function( event ){
next.apply( this, arguments );
$dlg.popup( "close" );
$dlg = null;
};
}
var $dlg = $( '.myDialog', $.mobile.activePage );
options = $.extend({}, {
onOK: function(){},
onNO: null,
onCancel: null
}, options) ;
$dlg.find( '.cancelButton' ).toggle( $.isFunction(options.onCancel) );
$dlg.find( '.noButton' ).toggle( $.isFunction(options.onNO) );
$dlg.find( '.okButton' ).off('vclick').on({ vclick: closePopup( options.onOK )});
$dlg.find( '.noButton' ).off('vclick').on({ vclick: closePopup( options.onNO ) });
$dlg.find( '.cancelButton' ).off('vclick').on({ vclick: closePopup( options.onCancel ) });
$dlg.find( '.dlg_caption' ).text( caption '' );
$dlg.find( '.dlg_title' ).text( title '' );
$dlg.find( '.dlg_text' ).text( text || '' );
$dlg.popup( "open" );
}
--------------------------------------------------------------------------------------------------
I'm not doing anything on page load or show but on click of a button I'm calling
--------------------------------------------------------------------------------------------------
MessageDialog( 'MyAppName', 'Alert Text' );
--------------------------------------------------------------------------------------------------
And nothing comes up. Nor is there any error on console.
Am I missing something ?