ffffff01
ffffff01

Reputation: 5238

Jquery UI dialog opens twice

I've got a problem with the UI Dialog.

After closing the dialog and reopening it, the dialog appears twice. One dialog with the old form data (which I dont want) and a new empty dialog.

I am closing the dialog after form submit in the following way:

$('.ui-dialog-titlebar-close').click();

I have also tried closing it this way:

$(this).closest('.ui-dialog-content').dialog('close');

Have anyone experienced similar behaviour?

Upvotes: 1

Views: 3552

Answers (3)

Robin Maben
Robin Maben

Reputation: 23044

While closing make sure that the dialog self-destructs..

$("#dialog").dialog({
  .
  .
  .
  close: function(){
     $(this).dialog("destroy");// I also use .remove() but its redundant
  }
});

Upvotes: 3

Aravindhan
Aravindhan

Reputation: 3626

try to put

          event.preventDefault():

which can stop the behaviour like this

Upvotes: 0

Ravi Gadag
Ravi Gadag

Reputation: 15861

try .dialog( "destroy" ) method. Dialog.destroy

$(this).closest('.ui-dialog-content').dialog('destroy');

Upvotes: 0

Related Questions