【发布时间】:2020-05-01 14:36:13
【问题描述】:
我正在使用 jQuery 2.4.1 min 版本构建一个简单的待办事项列表项目,但创建新待办事项时出现以下错误:
todos.js:12 Uncaught TypeError: event.stopPropogation is not a function
at HTMLSpanElement.<anonymous> (todos.js:12)
at HTMLUListElement.dispatch (jquery-2.1.4.min.js:3)
at HTMLUListElement.r.handle (jquery-2.1.4.min.js:3)
(anonymous) @ todos.js:12
dispatch @ jquery-2.1.4.min.js:3
r.handle @ jquery-2.1.4.min.js:3
js文件:
$("ul").on("click", "li", function(){
$(this).toggleClass("completed");
});
$("ul").on("click","span",function(event){
$(this).parent().fadeOut(500,function(){
$(this).remove();
});
event.stopPropogation();
});
$("input[type='text']").keypress(function(event){
if(event.which === 13)
{
var todosText=$(this).val();
$(this).val("");
$("ul").append("<li><span>X<span> " + todosText + "<li>");
}
});
【问题讨论】:
标签: javascript jquery html css error-handling