Add button does not work. I have read everything here


#1


So I have been staring at this code for ages now. The exercise lets me through, says its fine, proceed to the next lesson. But it doesn't WORK!

This is a the ADD section of the code. I would like to understand this. So if someone can tell me why my ADD button will not work, that would be great. I can not click it and nothing shows up in a list below. Is it a typo somewhere or something? I can not figure this out at all!


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


#2

obviously as soon as I post this I find my problem.

$('list').append('

' + toAdd + '
');

SHOULD BE

$('.list').append('

' + toAdd + '
');

That stupid little dot before list has caused me all this pain.

Thanks anyway.


#3

Okay! Cool you figured that out. :wink:


#4

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