-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
I am trying to create a custom toastrPrompt() function and get the return value(s)
<button type="button" class="btn btn-danger btn-delete">Delete</button>
$('.btn-delete').click( function(){
var result = toastrPrompt();
console.log(result);
})
function toastrPrompt() {
toastr.options = {
progressBar: true,
showMethod: 'slideDown',
timeOut: 0,
tapToDismiss: false,
extendedTimeOut: 0,
};
toastr.success('<br><br><button type="button" id="delete" class="btn btn-danger">Yes</button> <button type="button" id="close" class="btn btn-default">Cancel</button>',
'delete item?', {
closeButton: false,
allowHtml: true,
onShown: function () {
$("#delete").click(function(){
$(this).closest('.toast').fadeOut();
return 'true';
});
$("#close").click(function(){
$(this).closest('.toast').fadeOut();
return 'false';
});
}
});
}
Metadata
Metadata
Assignees
Labels
No labels