Skip to content

Instantly share code, notes, and snippets.

@maasha

maasha/dialog.js Secret

Created May 13, 2016 13:21
Embed
What would you like to do?
/**
* Delete node.
* @param {Object} node Node to delete.
*/
function nodeDelete (node) {
var dialog = $('<div/>').attr({id: 'dialog-confirm', title: 'Delete node?'})
var msg = $('<p/>').text('This will also delete all sub-nodes. Are you sure?')
var icon = $('<span/>').addClass('ui-icon ui-icon-alert ui-warning')
$(icon).prependTo(msg)
$(msg).appendTo(dialog)
$(dialog).appendTo('body')
$('#dialog-confirm').dialog({
autoOpen: false,
resizable: false,
height: 300,
width: 500,
modal: true,
buttons: {
Delete: function () {
alert('Deleting ...')
$(this).dialog('close')
},
Cancel: function () {
$(this).dialog('close')
}
}
})
$('#dialog-confirm').dialog('open')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment