A JavaScript application 💻 that demos DOM manipulation. This demo app will only live in the browser until the page is refreshed and is not connected to a database at this time. Keep track of your grocery list 🍓 🍅 🍞 by adding and removing items. See core recommendations via a popular items section and check off items as you add them to your cart...happy shopping!
document.querySelector
: grabs an element by its id or class namedocument.createElement
: dynamically creates an html element of choiceelemVariable.innerText
: sets the text content on that elementelemVariable.className
: dynamically assigns a class name to the elementparentElemVariable.appendChild(childElemVariable)
: places this element in the correct place on the DOMparentElemVariable.removeChild(childElemVariable)
: removes this element in the DOMe.target
: the element that has been targeted by the user (usually due to some event...such as a click event)e.target.classList
: gets the list of class names attached to the element that was targetede.target.classList.toggle(someClassName)
: dynamically changes the class assigned to a targeted element...this is very useful to give visual feedback to the user based on an interaction