 
   # Handler for [data-cart-toggle] change events.
   toggle: (e) ->
-    $input = jQuery(e.target)
+    $input = jQuery(this)
     id = $input.data('cartToggle')
     if $input.is(':checked')
       CartJS.Core.addItem(id)


  # Handler for [data-cart-toggle-attribute] change events.
  toggleAttribute: (e) ->
    $input = jQuery(e.target)
    attribute = $input.data('cartToggleAttribute')
    CartJS.Core.setAttribute(attribute, if $input.is(':checked') then 'Yes' else '')


  # Handler for [data-cart-add] click events.
  add: (e) ->
    e.preventDefault()
    $this = jQuery(this)
    CartJS.Core.addItem $this.data('cartAdd'), $this.data('cartQuantity')

  # Handler for [data-cart-remove] click events.
  remove: (e) ->
    e.preventDefault()
    $this = jQuery(this)
    CartJS.Core.removeItem $this.data('cartRemove')

  # Handler for [data-cart-remove-id] click events.
  removeById: (e) ->
    e.preventDefault()
    $this = jQuery(this)
    CartJS.Core.removeItemById $this.data('cartRemoveId')

  # Handler for [data-cart-update] click events.
  update: (e) ->
    e.preventDefault()
    $this = jQuery(this)
    CartJS.Core.updateItem $this.data('cartUpdate'), $this.data('cartQuantity')

  # Handler for [data-cart-update-id] click events.
  updateById: (e) ->
    e.preventDefault()
    $this = jQuery(this)
    CartJS.Core.updateItemById $this.data('cartUpdateId'), $this.data('cartQuantity')

  # Handler for [data-cart-clear] click events.
  clear: (e) ->
