Skip to content

Tag: dom-events

Why currentTarget value is null

I am learing event.target and event.currentTarget. I think i am clear with the difference between the two. But stuck in a situation where event.currentTarget value turns out to be null. Following are the HTML and JS code snippets: HTML code JavaScript Code My doubt is that in line1 and line3 I got the value o…

Execute Javascript code on HTML button click

I’m currently making an eshop. I use cookies to store the shopping cart. This is my HTML button: And when the user clicks this button I want to execute the following Cart.js code, which simply creates a cookie and add the product id to cookie cart. My problem is that when I click the button it takes no …