12. Append to Body


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() {
            var toAdd = $('input[name=checkListItem]').val();
            $(".list").append( "<div class="item">" + toAdd + "</div>");



"<div class="item">"

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


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.