爲什麼我收到此錯誤:的jQuery()方法調用的最大堆棧大小超過
Uncaught RangeError: Maximum call stack size exceeded
這裏是我的代碼:
$(document).on('keypress focusout', '.checklist-item-input', function (e) {
if (e.which == 13 || e.type == 'focusout') {
$('.checklist-item').removeClass('edit');
$(this).siblings('.checklist-item-detail').text($(this).val());
$(this).blur();
$('.checklist-item-detail').each(function() {
if (!$(this).text().length) {
$(this).closest('.checklist-item').parent().remove();
}
});
}
});
「原因focusout'你叫'.blur()'這引起了'focusout'它調用'.blur()'這引起了調用'.blur()'調用'.blur()'調用'.blur()'調用'.blur()'調用'.blur()'調用'.blur()'調用'.blur()'' ....等 –
'$(this).blur();'執行聚焦事件,無限次稱爲 –