12. Append to Body


#1


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


Codecademy says that I have passed the exercise. However, when I enter an item into the box and click the button, it returns "[object Object]" instead of what I entered for some reason.


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


#2

here:

var toAdd=$('input[name=checkListItem]');

you need to retrieve the value from the input using val()


#3

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