I have dialog created like this
$('#add_error').click(function(e) {
$('<div>')
.load('/someaction/format/html/')
.dialog({
title: 'Some title',
modal: true,
width: 385,
close: function() {
$(this).remove();
}
});
e.preventDefault();
});
It works ok, but every third (not really sure if its really third) time I click link to open dialog, it fails with error in firebug
"$("").addClass("ui-widget-overlay") is undefined"
In dialog.js that is piece of code:
var $el = (this.oldInstances.length ? this.oldInstances.splice(0, 1)[0] : $('<div></div>').addClass('ui-widget-overlay'))
.appendTo(document.body)
.css({
width: this.width(),
height: this.height()
});
under create: function(dialog) method.
Strange thing is that this error does not occur when I remove
close: function() {
$(this).remove();
}
Any idea?