cart.js
// Calls ready function when ready. Lets you add or remove items in cart
Calls ready function when ready. Lets you add or remove items in cart
Calls ready function when ready . Lets you add or remove items in cart
function ready() {
    var removeCartItemButtons = document.getElementsByClassName('btn-danger')
    for (var i =0; i < removeCartItemButtons.length; i++) {
        var button = removeCartItemButtons[i]
        button.addEventListener('click', removeCartItem)
}
    var quantityInputs = document.getElementsByClassName('cart-quantity-input')
    for (var i =0; i < quantityInputs.length; i++) {
        var input = quantityInputs[i] 
        input.addEventListener('change', quantityChanged)
}
    var addToCartButtons = document.getElementsByClassName('shop-item-buttons')
    for (var i =0; i < addToCartButtons.length; i++) {
        var input = addToCartButtons[i] 
        input.addEventListener('click', addToCartClicked)
}
}
function ready ( ) { var removeCartItemButtons = document . getElementsByClassName ( 'btn-danger' ) for ( var i = 0 ; i < removeCartItemButtons . length ; i ++ ) { var button = removeCartItemButtons [ i ] button . addEventListener ( 'click' , removeCartItem ) } var quantityInputs = document . getElementsByClassName ( 'cart-quantity-input' ) for ( var i = 0 ; i < quantityInputs . length ; i ++ ) { var input = quantityInputs [ i ] input . addEventListener ( 'change' , quantityChanged ) } var addToCartButtons = document . getElementsByClassName ( 'shop-item-buttons' ) for ( var i = 0 ; i < addToCartButtons . length ; i ++ ) { var input = addToCartButtons [ i ] input . addEventListener ( 'click' , addToCartClicked ) } }
Calls ready function when ready.
Calls ready function when ready .