Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#5730 closed enhancement (wontfix)

Dialog destroy option to destroy self.element

Reported by: cmathis430 Owned by:
Priority: minor Milestone:
Component: ui.dialog Version: 1.8.2
Keywords: destroy Cc:
Blocked by: Blocking:


For dialogs created with anonymous content, it would be nice to have an option to destroy the dialog along with the content.

Anonymous content dialog:

$('<div>Anonymous content</div>').dialog({
	close: function() {

I want to add a parameter to specify whether to remove the original content as well when calling destroy:

$(this).dialog('destroy', true);

Below is a change I made to allow this:

In jquery.ui.dialog.js line 164 I made the following change:

destroy: function(destroySelf) {
	var self = this;
	(self.overlay && self.overlay.destroy());
		.removeClass('ui-dialog-content ui-widget-content');
	if (!destroySelf) {

	(self.originalTitle && self.element.attr('title', self.originalTitle));

	return self;

Change History (2)

comment:1 Changed 12 years ago by Scott González

Resolution: wontfix
Status: newclosed

Just use .remove() instead of .dialog( "destroy" ).

comment:2 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.