Append to Body: Code my is not working ... but was excepted anyway


this is the code i used

$(document).ready(function() {
var toAdd = $('input[name=checkListItem]').val();

' + toAdd + '

and i got the error

"Uncaught SyntaxError: Unexpected identifier"

when i click the add div nothing happens but if i submit it still says "Way to go! Start Next Lesson"

any ideas?



I don't know why it is accepting your code, but you have forgotten a ')' on line 2 after function. If you run it with the ) it should run normally.


Thank you, is always the small stuff you miss that dose it, lol


Any ideas on this one... its adding to my added div list.. just not adding the input properly?


Nothing big is going on here either, I guess. You should write checkListItem with 2 capital letters; See if that works


The reason it's not working is because your [name=checklistItem] is wrong, it should be checkListItem. Notice the camel case on the L! That should fix it!


I don't understand this one at all. The way the directions read to me it means I am supposed to add a new class to the div AND also add the new item from the variable. How do you add both with append? I don't understand the directions.