Javascript 创建新todos代码生成错误
我正在使用jQuery 2.4.1 min版本构建一个简单的todo列表项目,但创建新的todo时出现以下错误:Javascript 创建新todos代码生成错误,javascript,jquery,html,css,error-handling,Javascript,Jquery,Html,Css,Error Handling,我正在使用jQuery 2.4.1 min版本构建一个简单的todo列表项目,但创建新的todo时出现以下错误: 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 HTMLUListEleme
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
todos.js:12未捕获类型错误:event.stopPropogation不是函数
在HTMLSPANENT。(todos.js:12)
在HtmlListElement.dispatch(jquery-2.1.4.min.js:3)
在htmlListElement.r.handle(jquery-2.1.4.min.js:3)
(匿名)@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>");
}
});
$(“ul”)。在(“单击”,“li”,函数()上){
$(此).toggleClass(“已完成”);
});
$(“ul”)。在(“单击”,“跨距”,功能(事件){
$(this.parent().fadeOut(500,function()){
$(this.remove();
});
event.stopPropogation();
});
$(“输入[type='text']”)。按键(函数(事件){
if(event.which==13)
{
var todosText=$(this.val();
$(此).val(“”);
$(“ul”)。追加(“X”+todosText+” ”;
}
});
您在事件.stopPropogation()中有拼写错误。
。您必须写入事件.停止播放()
。希望这能解决您的问题。您在事件.stopPropogation()中有拼写错误。
。您必须写入事件.停止播放()
。希望这能解决您的问题。是的,它确实消除了错误,但新TODO的创建仍然无法正常运行。在附加html时,关闭标记中也缺少“/”。与