What is the difference between .dialog(\"close\")
and .dialog(\"destroy\")
in jquery-ui?
I have a script where the previous developer had used
Remember if you are using the dialog for forms input, that destroying it will NOT remove your input, so if you are validating with the :input pseudo selector, the elements you 'destroyed' will be validated. This is where .remove() comes in handy.
You can add a custom close event that destroys your dialog and removes any form inside it to prevent further validation of it.
$dialog = $("#your_dialog_id");
$dialog.dialog('option', {
title: "title",
close: function (event, ui) {
$dialog.find("form").remove();
$dialog.dialog('destroy');
}
});