13/14 toAdd not defined


#1

Why is toAdd not defined. Have I missed something like a semi-colon or made a bigger mistake?

$(document).ready(function(){

$('#button').click(function(){
    var toAdd = $('input[name=checkListItem]').val();
    });

$('.list').append('<div class="item">' + toAdd + '</div>');

$().on('.click', '.item', function(){
    $(this).remove();

    });

});

#2

Hi Cmwebz,

You need to remove the }); on line 5-ish down to right after the $('.list').append(...); line. Then, you need to put document in between the parenthesis (()) on line 9-ish.

I hope this helps, please let me know if you're still having issues with the exercise :)


#3

That did the trick thanks :-). Just needed to move }); down to the bottom and remove the . from click


#4

Good you caught that last bit. It was a deal breaker.


#5

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