$("ul").on("click", "li", function(){
$(this).toggleClass("completed");
});
//Deleting the todos:
$("ul").on("click", "span", function(event){
$(this).parent().fadeout(500,function(event){
$(this).remove();
});
event.stopPropagation();
});
// Creating new todos
$("input[type='text']").keypress(function(event){
if(event.which === 13){
var todoText = $(this).val();
$(this).val("");
$("ul").append("<li><span>X </span>"+ todoText +"</li>");
}
})
当我单击 span 元素以淡出任务时,它在控制台中显示错误。我附上了它显示的错误图片!