12/14 (Append to Body) Glitch or Error?


#1

I'm on the 12th lesson of Modifying HTML Elements.

I keep getting this error:
Oops, try again. Make sure to use .append() to add your .item to your .list!

Here's my code:

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

#2

Although your code would have functioned,
the code checker is explicitly checking on the syntax

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

The jQuery selector as you use it
$('div.list')
is NOT needed,
as using
$('.list') would be specific enough.


#3

I'm on this same lesson and I can't seem to work my way through it... Below is my code...

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

' + toAdd + '
');
});
});

I'm getting the error: Oops, try again. Did you call .on() on $(document) ?
Someone please help me?


#4

Oops, sorry, I didn't post my code correctly, this is my code. Can someone please tell me what's wrong with it?

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

#5

This section is messed up. I have the wrong code and it lets me pass. I fixed my code independent but the section if flawed. I have passed with 3 different code and two of the 3 didn't work!


#6

` I simply used the below and it worked.

$('.list').append("<div class="item">")


#8

I'm really confused here, what are we appending? Are we appending a new class named item to the existing class list?