Confirm Dialog Returns False Immediately
This is my code: index.html: ... <
Solution 1:
In PhoneGap, confirm is does an asynchronous callback. See the api docs.
The variable answer will always be false because of the immediate return.
The code should look more like:
// process the confirmation dialog result
function onConfirm(button) {
alert('You selected button ' + button);
}
// Show a custom confirmation dialog
//
function showConfirm() {
navigator.notification.confirm(
'You are the winner!', // message
onConfirm, // callback to invoke with index of button pressed
'Game Over', // title
'Restart,Exit' // buttonLabels
);
}
Post a Comment for "Confirm Dialog Returns False Immediately"