12/14 Append to body


#1

Hello there,

I have a question about this assignment. I haven't code for 2 weeks now and I'm totally confused.
I feel like I am reading Chinese at the moment. Please don't post answers of the assignment, I only want to understand what is going on in here.

In previous task I created variable called toAdd which is there to save input that user makes.
Now I need to append values that user inputs into div class = "list". But then comes some div class called item that doesn't exists yet but it is there to help us delete items later I guess. And at the end comes assignment :

--> Go ahead and .append() a <div> with class="item" to the .list div of your HTML document.

So I am appending div that doesn't exists to the div that I have with a variable tooAdd where inputs are saved. Example of something like this is :

'<div class="item">' + toAdd + '</div>' . My brain blocked. It is simple but at the moment for me it isn't.


#2

Hi Dayfiri,

Would you mind posting your code so we can go through and and point out what's wrong? I'm happy to help, but it's much easier to point out and explain problems in code than to explain the whole exercise :wink:


#3

Hello @dayfiri-

For this assignment, toAdd is the text that will be in the item on the to do list, for example, "wash my car." So what you are doing is creating a new div with the class item that says, "wash my car." Then, once you've washed your car, you'll want to take that item off the list, so you would click on it to remove it, which also removes that div.

The item class doesn't exist yet because there aren't currently any items on the to do list when you start the exercise. But what you're doing in this exercise is creating the code that will add your new div ("wash my car") to the end of the to do list, which currently is empty.

Does that make any more sense?