When "add.png" image with class "button" is clicked it will add item to cart and transform into "remove.png" When it is clicked again it will remove the item from cart and transform back into its original "add.png"
This works with Jquery 1.7 and below but the .toggle() feature has been removed from newer versions of Jquery.
The desired outcome is to preform the same exact task but with .click() instead of .toggle()
<img class="button" data-product-id="Item1" src="add.png" />
<script>
$(".button").toggle(function(){
//first functon here
simpleCart.add({
name: $(this).attr("data-product-id"),
price: .99,
quantity: 1
});
//we set src of image with jquery
$(this).attr("src", "remove.png");
},function(){
//second function here
//simplecart remove function here, this isjust example, adjust with your code
simpleCart.add({
name: $(this).attr("data-product-id"),
price: .99,
quantity: -1
});
$(this).attr("src", "add.png");
});
</script>