Reputation: 3255
Is it possible to get confirmation dialog with yes , no option instead of ok,cancel in javascript ?
Upvotes: 3
Views: 5952
Reputation: 8552
$('<div></div>').appendTo('body')
.html('<div><h6>Are you sure?</h6></div>')
.dialog({
modal: true, title: 'Delete message', zIndex: 10000, autoOpen: true,
width: 'auto', resizable: false,
buttons: {
Yes: function () {
// $(obj).removeAttr('onclick');
// $(obj).parents('.Parent').remove();
$(this).dialog("close");
},
No: function () {
$(this).dialog("close");
}
},
close: function (event, ui) {
$(this).remove();
}
});
for Demo :
Upvotes: 0
Reputation: 13427
Not with the native confirm function. You would have to use a custom dialog. Fortunately, there are a lot of good ones available, check out jQuery and it's plug-ins.
Upvotes: 1
Reputation: 16613
The default confirmation box is baked into browsers. But you can make use of modal dialogs with the little help of plugins like jQuery UI Dialog or BlockUI.
Upvotes: 2
Reputation: 449395
Not using the native browser functions, no.
You would have to use a custom dialog class like jQuery dialog.
Upvotes: 6