Strange jQueryUI dialog error
Posted
by umpirsky
on Stack Overflow
See other posts from Stack Overflow
or by umpirsky
Published on 2010-03-05T07:21:09Z
Indexed on
2010/03/08
17:06 UTC
Read the original article
Hit count: 973
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?
© Stack Overflow or respective owner