Code isn't working but is accepted anyways


#1

Here is the code i used, it was accepted by the tutorial but nothing happens when i click

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

It says missing ) after argument list.


#2

Hi Meghal,

Thanks for reporting this!
In case you didn't figure it out, you need to add a }); on the next to last line :)


#3

Hi,

I'm in the same case : succeeded every step but the append is not showing.
Sorry but I don't understand your answer "you need to add a }); on the next to last line"

Where is it missing ?

My code

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

Thanks


#4

HI @mitsudomoe,

You need to use single quotes (') around the HTML, and double quotes (") inside the HTML (for class="") on line 10.

Next time, or if you still need help, please create a new topic.
Thanks!