Skip to content

Instantly share code, notes, and snippets.

@nbeers22
Last active April 3, 2019 08:26
Show Gist options
  • Save nbeers22/9658245e8746ff43fc93ae6c12314018 to your computer and use it in GitHub Desktop.
Save nbeers22/9658245e8746ff43fc93ae6c12314018 to your computer and use it in GitHub Desktop.
shopping list pseudocode

Adding New Items

  1. When form is submitted, prevent form from refreshing and get value of input
  2. Add the new item to the STORE variable

Delete Item from list

  1. use click handler to determine which item was clicked using $(this)
  2. traverse up the DOM to the parent
  3. Grab the id in data-item-id to use to remove from the STORE
  4. use jQuery .remove() to remove the
  5. from the DOM completely

Check/Uncheck Item

  1. use click handler to determine which item was clicked using $(this)
  2. traverse up the dom to find the class 'shopping-item' and toggleClass('shopping-item__checked')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment