Response title
This is preview!
I want to show a dialog with several options. Then, after the user selects an option, show a modal dialog to confirm the operation ("Do you confirm the selection?"). I tried this code (right after a selection is made):
- $('#ui-dialog-list').live('pagehide',confirmSelection());
- // ui-dialog-list = dialog with several options
- $('#ui-dialog-list').dialog('close');
- ...
- function confirmSelection()
- {
- confirmDialog("Do you confirm selection?", function () {
- console.log("Confirmed");
- },function () {
- console.log("Not confirmed");
- });
- }
- function confirmDialog(message, yesFunc, noFunc) {
- $("#ui-dialog-conf div p.conf-message").html(mensagem);
- $("#conf-yes").click( function() { yesFunc(); });
- if (noFunc!=null) $("#conf-no").click( function()
- { noFunc(); } );
- $.mobile.changePage("#ui-dialog-conf", 'pop', true);
- }
- <div data-role="dialog" id="ui-dialog-conf">
- <div data-role="header">
- <h1 class="conf-title">Confirmation</h1>
- </div>
- <div data-role="content">
- <p class="conf-message"></p>
- <a href="#" data-role="button" data-inline="true" data-rel="back" id="conf-yes">Yes</a>
- <a href="#" data-role="button" data-inline="true" data-rel="back" id="conf-no">No</a>
- </div>
- </div>
The problem is that after closing the confirmation dialog, the previous dialog is still shown. So, what is the correct way to show nested dialogs? Thanks in advance!
© 2013 jQuery Foundation
Sponsored by and others.