12. Append to Body

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
Hi, I’ve tried searching for the error in my code but cannot find it.Can anyone please point out the mistake?

I received the error message:

“Uncaught SyntaxError: missing ) after argument list”

```

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

” + toAdd + “
”);
        });

});
<do not remove the three backticks above>

here:

"<div class="item">"

you need to use + to join/concatenate variable and string together just like you did with toAdd

2 Likes

Use alternate quotation marks like this:

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

instead of your:

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

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