Skip to content

Instantly share code, notes, and snippets.

@cgorshing
Created July 22, 2011 19:09
Show Gist options
  • Save cgorshing/1100171 to your computer and use it in GitHub Desktop.
Save cgorshing/1100171 to your computer and use it in GitHub Desktop.
jQuery Confirm Dialog (noConflict)
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('#deleteLink').click(function() {
return jQueryConfirm('#deleteLink', '<fmt:message key="buttons.delete.confirm"/>', 'Delete', 'Cancel');
});
});
function jQueryConfirm(id, message, confirmButton, cancelButton) {
var dialog = jQuery('<div></div>');
dialog.html(message);
var buttonOpts = {};
buttonOpts[confirmButton] = function() {jQuery(this).dialog("close"); window.location = jQuery(id).attr('href');};
buttonOpts[cancelButton] = function() {jQuery(this).dialog("close");};
var result = dialog.dialog({
resizable: false,
modal: true,
buttons: buttonOpts
});
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment