14. You Did It! - won't remove list items


#1

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

Everything works great, I just can't remove anything I add. Here's my code:

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

Thanks for your help.


#2

Hi Travis,

Try comparing your selector for list items to what the instructions say :slight_smile:

Hint (click to view)

You have item on line 6, but that selects the (nonexistent) HTML element <item>. You need to select .item, which selects any element with the class="item" attribute :slight_smile:


#3

Aha! Thank you very much sir!


#4

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