Append to body


#1

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

hello there! my code works and makes sense too but there is just one problem. when i enter in the input field an item lets say i enter "h", it wont display on screen as "h" instead it displays as [object Object]. what's the problem?


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

#2

you didn't use .val( )method .you should use it to get the values of form elements such as input, select and textarea.

here

var toAdd = $('input[name=checkListItem]').val();

#3

thanks alot rcodeman :slight_smile: i can't believe i did this silly mistake.


#4