2
我的想法起初是這是一個語法問題,但我沒有看到任何語法問題。我已經添加調試代碼,這給了奇怪的結果,x
登錄之前jQuery('#notification')
執行setTimeout後元素列表後的Javascript錯誤「丟失」
document.triggerNotification = function (type, message) {
jQuery(document.body).append("<div class='push-notification push-"+type+"' id='notification'>"+message+"</div>");
setTimeout(jQuery('#notification').fadeOut(1200, function() {
console.log(jQuery('#notification'));
jQuery('#notification').remove();
console.log(jQuery('#notification'));
}), 3000);
console.log('x');
}
螢火蟲提供了以下的輸出:
x
[div#notification.push-notification]
[]
missing ] after element list - [Break on this error] [object Object]
一切都成功執行,但它仍然拋出一個錯誤。
不要忘記刪除'console.log()' – Sam 2010-09-21 14:51:45