I am trying to make an interactive button(to show a message in the console) with js, which just print a message in the console when the button is pressed. My js file is:
console.log("hello this is from cart.js")
var updateBtns = document.getElementsByClassName('update-cart')
for(var i=0; i<updateBtns.length; i++){
updateBtns[i].addEventListener('click', function(){
var productId = this.dataset.product
var action = this.dataset.action
console.log("inside loop")
//console.log('product ID: ', productId, "Action: ", action)
})
}
HTML:
<button data-product="{{ i.id }}" data-action="add" class="btn btn-outline-secondary add-btn update-cart">Add to Cart</button>
Here inside loop message does not show anytime.... the consol just show the following message:
hello this is from cart.js
DevTools failed to load SourceMap: Could not load content for chrome-extension://ndjpnladcallmjemlbaebfadecfhkepb/editor/config.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://ndjpnladcallmjemlbaebfadecfhkepb/editor/content.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
How can I solve this problem?