This shopping list project is an example of creating a basic todo list. I used materialpalette to pick out the color combinations I included and the process involved appending and removing nodes in the app for the list.
I was creating the list items dynamically and I created variables to hold the string for the three types of button; to delete the item, to mark the item as acquired, and to undo that mark.
1 2 3 |
|
The next part of the script was the submit
event handler appends a new item to
the list unordered list.
1 2 3 4 5 |
|
The next three statements were created using the on
event handler and
attaching them to the three variable buttons created. I used on
instead of
click
because the latter would only attach the click function if the button
exists when the page is first loaded.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
The last on
click handler removes the whole list and basically restarts the
whole app.
1 2 3 |
|