Using framework7, I would like to create a cart view on my application following you-tube tutorial.
I checked that the js file is properly called but the button is not working. If I click the button, console.log('clicked')
should be displayed, but It doesn't work.
https://github.com/hahmmj/IPP20201_HALFSTACK
Javascript code:
console.log("storejs")
window.onload = () => {
var removeCartItemButtons = document.getElementsByClassName('btn-danger');
console.log(removeCartItemButtons)
for (var i = 0; i < removeCartItemButtons.length; i++){
var button = removeCartItemButtons[i]
button.addEventListener('click', function(){
console.log('clicked')
})
}
}