Skip to content

Instantly share code, notes, and snippets.

@zergiocosta
Last active August 31, 2015 17:18
Show Gist options
  • Save zergiocosta/c51a0ed1323a2c008c45 to your computer and use it in GitHub Desktop.
Save zergiocosta/c51a0ed1323a2c008c45 to your computer and use it in GitHub Desktop.
Manipulating content into alert boxes
// simple alert box
navigator.notification.alert(
"Alert body text",
myFunction, // function to be called when alert is triggered
'My alert title',
"Button"
);
function myFunction(){
console.log('working fine');
}
////////////////////////////////////////
// alertbox with options
navigator.notification.alert(
"Alert body text",
myFunction, // function to be called when alert is triggered
'My alert title',
["OK", "Back to app"]
);
function myFunction(b){
if(b == 1){
console.log("user said OK");
} else {
console.log("user said Back to app");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment