12. Append to Body


#1


https://www.codecademy.com/en/courses/web-beginner-en-v6phg/2/3?curriculum_id=50a3fad8c7a770b5fd0007a1#


Code is accepted; however, the following message appears: "Uncaught SyntaxError: missing ) after argument list".

What's wrong with my code?


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


#2

item should be a printed string, not a variable. The double quotes need to be escaped.

Alternately, write the outer with a single quote so the HTML attribute quote writes as a double.

'<div class="item">' + toAdd + '</div>'

#3

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