Demo of Confirmation Box with two options for selection using JQuery



HTML

<button id="b1">Open confirmation  Box</button>
<div id="dialog-window"></div>
<div id=display></div>

JQuery

<script>
$(document).ready(function() {
///////////////////
$("#dialog-window").dialog({
        resizable: false,
        autoOpen: false,
        modal: true,
        title: "Confirm Box",
        height: 250,
        width: 400,
        buttons: {
            "Yes": function () {
                $(this).dialog('close');
                callback(true);
            },
                "No": function () {
                $(this).dialog('close');
                callback(false);
            }
        }
 });
//////////////////
function callback(value) {
 if (value) {
  $('#display').html('You clicked Yes button') 
 }// end of if (value )
else{
// code to execute if false
$('#display').html('You clicked No button') 
}
} // end of callback function 
///////////////////
$("#b1").click(function(){
$("#dialog-window").html("Confirm to Submit ...");
$( "#dialog-window" ).dialog( "open" );
})
////////////////////////
})</script>