MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / addToCartClicked

Function addToCartClicked

assets/js/store.js:52–60  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

50}
51
52function addToCartClicked(event) {
53 var button = event.target
54 var shopItem = button.parentElement.parentElement
55 var title = shopItem.getElementsByClassName('shop-item-title')[0].innerText
56 var price = shopItem.getElementsByClassName('shop-item-price')[0].innerText
57 var imageSrc = shopItem.getElementsByClassName('shop-item-image')[0].src
58 addItemToCart(title, price, imageSrc)
59 updateCartTotal()
60}
61
62function addItemToCart(title, price, imageSrc) {
63 var cartRow = document.createElement('div')

Callers

nothing calls this directly

Calls 2

addItemToCartFunction · 0.70
updateCartTotalFunction · 0.70

Tested by

no test coverage detected