Shopify购物车Ajax

I'm trying to do this in my Shopify theme for Ajaxed cart and add to cart. Add to cart works perfectly, but if I want to change a div if an item has been added, it won't happen:

 Shopify.onItemAdded = function(line_item) {
    $('cart').update('Added '+line_item.title + '...');
    Shopify.getCart();
  }

But nothing changes. This works however:

 Shopify.onItemAdded = function(line_item) {
    alert('yass');
  };

Why doesn't the div update when an item is added to cart?