function deleteconfirmation() {
jAlert('The Answer was deleted succsfully', 'Deletion Confirmation');
$(this).fadeOut('slow', function () { $(this).remove(); });
}
但是当它被执行时,它将在jquery-1.6.2.min.js内的if(!(e=a.ownerDocument.defaultView))
上返回以下错误"Microsoft error: Unable to get value of the property 'defaultView':object is null or undefined“。提示:-此错误仅在我使用IE时发生,如果我使用chrome或firefox时不会出现此错误!那么,这可能是什么原因造成的呢?BR
发布于 2012-05-03 19:03:37
这个错误是由你的$(this)
没有引用任何东西,或者是window object
引起的。这取决于您的函数是如何调用的。最好将您想要使用的元素传递给函数deleteConfirmation()
,如下所示:
$("#deleteAnswer").bind("click", function() {
deleteConfirmation(this);
});
function deleteConfirmation(element) {
jAlert('Deleted succsfully', 'Deletion Confirmation', function() {
alert("The user clicked ok");
// Hides the element that caused the click event
$(element).fadeOut('slow', function () { $(element).remove(); });
});
}
有关示例,请参阅此jsfiddle。
如果您正在尝试fadeOut
警告框本身,那么默认情况下会这样做,您可能已经知道这一点。
发布于 2012-05-14 08:46:12
我想您忘了添加jQuery库的引用了。请检查此选项并添加到jQuery Reference
另一种可能是放弃在您正在使用的页面中添加jAlert的引用。
https://stackoverflow.com/questions/9647584
复制相似问题