plethorax
plethorax

Reputation: 149

Creation of new todos code generating error

I'm building a simple project of todo list using jQuery 2.4.1 min version but the creation of new todos is giving me the following error:

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 file:

$("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>");

    }

});

Upvotes: 0

Views: 25

Answers (1)

Muhammad Hassan Khan
Muhammad Hassan Khan

Reputation: 149

You have a spelling mistake in event.stopPropogation(). You must write event.stopPropagation(). Hope this solves your problem.

Upvotes: 2

Related Questions