Created
January 25, 2013 19:47
-
-
Save Dillie-O/4637250 to your computer and use it in GitHub Desktop.
Remove duplicate jQuery UI dialog objects before display.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thank you StackOverflow!!! | |
// http://stackoverflow.com/questions/7099938/jquery-ui-dialog-behaves-unpredictably | |
var original = $('#dialogId')[0]; | |
var clone = $(original).clone().attr('id', 'dialogIdClone'); | |
var saveHtml = $(original).html(); | |
$(original).html(''); | |
$(clone).dialog({ | |
... // other options | |
open: function (){ | |
// add any dynamic behavior you need to the dialog here | |
}, | |
close: function(){ | |
$(clone).remove(); | |
$(original).html(saveHtml); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment