DEV Community

Discussion on: Simple add to cart animation with CSS & JS

Collapse
 
patrykdeja profile image
Patryk Deja • Edited

The problem is with card_value.nodeValue. Value of nodeValue used on an element returns null. So you should use an alternative for nodeValue like innerText or innerHTML.

Something like this:

if(Number(card_value.innerText) - 1 >= 0){
        card_value.textContent = cartvalue -=1;
}
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
nikhil27b profile image
Nikhil Bobade

Thanks bro I just copied your and edited code. Because of you I fix today