notification.confirm( )

notification.confirm()

navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])

Shows a customisable confirmation dialog box.

Parameters #

  • message: Dialog message (String)
  • alertCallback: Callback to invoke with index of button pressed (1, 2 or 3). (Number)
  • title: Dialog title (String) (Optional, Default: "Confirm")
  • buttonName: Comma separated string with button labels (String) (Optional, Default: "OK,Cancel")

Supported Platforms #

  • Android
  • BlackBerry WebWorks (OS 5.0 and higher)
  • iOS (OS 4.0 and higher) 

Examples #

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
    );
}