HTML
<div style= "width: 100%; text-align: center; margin: auto; margin-top: 30%;">
<h3>Using Prompt Function</h3></br></br>
<button id="prompt">Show Prompt</button>
</div>
JAVASCRIPT
document.getElementById('prompt').addEventListener('click',showPrompt);
var options = ["Display","Cancel"];
function showPrompt(){
navigator.notification.prompt(
"Please enter your name",
promptCallback,
"Welcome User"
);
}
function promptCallback(results){
var buttonIndex = results.buttonIndex;
var input1 = results.input1;
if(buttonIndex==1){
alert("Hello " + input1 + " welcome to Thakur College");
}else{
alert("cancelled");
}
}