12/14 - Append to Body not working


#1

I don't see what I'm doing wrong here. The code looks correct to me. Keeps giving an error saying I'm not appending a DIV tag to the list.

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

#2

Hi try to put It inside the click event


#3

Ah yes that worked. Thanks.


#4

Thank you! That worked for me too :slightly_smiling:


#6

A post was split to a new topic: 12/14 - Append to Body


#7