Removing what's been Clicked


#1


https://www.codecademy.com/en/courses/web-beginner-en-v6phg/2/4?curriculum_id=50a3fad8c7a770b5fd0007a1


I've written the code the way that it wants me to, but when I click on my list items they don't disappear.
Did I do something wrong or is the exercise just bugged?


$('document').ready(function() {
    $('#button').click(function() {
        var toAdd = $('input[name=checkListItem]').val();
        $('.list').append("<div class='item'>" + toAdd + "</div>");
    });
    $(document).on('click', '.item', function() {
        $('item').click(function() {
            $(this).remove();
        });
    });
});


#2

$('item').click(function() { //remove this line

you dont need that.you already wrote a function for that.
dont forget to remove closing bracket too.
your code should be look like

   $(document).on('click', '.item', function() {
      $(this).remove()
      });
        });

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.