javascript - Uncaught TypeError: Cannot set property 'backgroundColor' of undefined -
function put_to_cart_event(prodtitle, price, clicked_cell){ var td = clicked_cell; alert(td); put_to_cart_({title: prodtitle, price: price}, function () { td.style.backgroundcolor = '#859de6'; // <--- problem }); }
the alert giving [object object]
, meaning the clicked_cell
available , accessable, right?
what missing here?
the function being called this:
$('.abindenwarenkorb').on('click', function(){ var productname = $('#productname').text(); var price = $('#price').text(); var in_stock = $('#in_stock').text(); var clicked_cell = $('#clicked_cell').val(); //value set $('#clicked_cell').val($(this)); put_to_cart_event(productname, price, clicked_cell); // <-- call });
its because clicked_cell
doesn't have style property. output clicked_cell variable in console.log?
Comments
Post a Comment