Lesson 12: 'use .append() to add' even though I am using it


#1

My solution...

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

When I hit save and submit button, I get a "Oops, try again. Make sure to use .append() to add your .item to your .list!" error but I am using append. Also, I'm able to enter data into the text input and click the Add button and it works. Anyone have an idea why my code isn't acceptable to codecademy?


#2

You are currently appending to div.list, while the question asks to append to .list. You were just too specific.


#3

Um - I had the same issue - too specific (div.list) - however, when I removed the div, I received a different error: It looks like you're not appending a "

" + toAdd + "
" to .list.