[13/14] Uncaught SyntaxError: Unexpected end of input


#1

$(document).ready(function() {

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

' + toAdd + '
");
$(document).on("click", ".item", function() {
$(this).remove();
});
});

What is wrong?
Also i copied this " ' + toAdd + ' " part from somebody and as i can see everybody else have this part. Where did it came from?


#2

Hi evghenii,

You're not seperating your functions properly :)
The layout should look like this:

$(document).ready(function() {
  $('#button').click(function() {
    // ...
  }); // close line 2 before this next function: 
  $(document).on("click", ".item", function() { // this goes *after* you close line 2; not inside the line 2 function
    // ...
  }); // close line 5
}); // you're missing this; it closes line 1

#3

Pretty complicated stuff, thanks anyway


#4

Glad I could help :)