SO Question 14556975
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css">
<div id="dialog-confirm" title="Dialog Title">this is some kind of dialogue</div>
<div id="result" />
<input type="button" value="open dialog" />
JavaScript
var myFunction = function (b) {
var H = b ? 'YES' : 'NO';
$('#result').text('You clicked ' + H + '!');
} // end myFunction
$("#dialog-confirm").dialog({
autoOpen: false,
resizable: false,
height: 180,
modal: true,
buttons: [{
text: 'Yes',
click: function () {
$(this).dialog('close');
myFunction(true);
}
}, {
text: 'No',
click: function () {
$(this).dialog('close');
myFunction(false);
}
}]
}); // end dialog create
$('input').on('click', function () {
$('#dialog-confirm').dialog('open');
}); // end on click