12. Append to body-- code apparently not working but accepted anyway


The following code for adding a

to the body of the document was accepted, but I wonder if it's not working--when I click the Add button, nothing happens; in fact, the button doesn't seem to be clickable at all.

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

Can anyone tell me what is wrong with the above code?

Hello and i do not know the body element for make a website please help me

Please post a link to the lesson so we can test your code. Thanks.

This is to the old course content, but I don't see where the new content is. We definitely could use a link.



The only thing unusual is the white space around the = sign. We don't normally write HTML this way, but it could be perfectly valid. Try removing the spaces and see what happens.


Here is the link
the lesson.


Your code does work as expected. Did you try entering some text before clicking add?


Thank you! It seems I just misunderstood what the code was expected to do.


A post was split to a new topic: Modifying HTML elements - code not appearing


A post was split to a new topic: It wouldn't let me move forward: