Append to body RESULT



my code passed but the result is little confusing

    var toAdd = $('input[name=checkListItem]').val();
    $('.list').append("<div class = 'item'>"+toAdd+"</div>");


why does the result display in red when i didnt have a CSS for the DIV 'item',There is div for list but not for item so why is the text color red?


Hey, item is under list thus it uses its style..


so append works like this

<div class = 'list'> <div class ='item'> </div></div> ??


sorry the code didnt paste ...i kind of understood it as i played with the code little the appended div is

between the existing DIV and not a new row


When you append something it adds it as the last child of the element.
Read more here


Thanks! it was very helpful...understood append little better now!!