I would like to show set display: none; on a div when the add to cart button is pushed. Where in the code would I put this?
I would like to show set display: none; on a div when the add to cart button is pushed. Where in the code would I put this?
Chris Martz
United Art & Education
The button is part of the html that's constructed in the ShoppingCart.cs class GetAddToCartForm function.
If you have source code you could modify this code to do what you want. However, we like to use other solutions instead of changing source.
We like to use JQuery for this type of modification. You could use JQuery to attach a javascript event to the add to cart button click. There's no change to source or your XMLPackage using this technique.
Another option is (in your product XMLPackage) to write the aspdnsf:AddtoCartForm to a variable and then do a aspdnsf:StrReplace to include a javascript onclick event. You could add a javascript function to your XMLPackage as required.
Where would I put javascript in the shoppingcart.cs to make the div display?
Chris Martz
United Art & Education
I tried putting onClick=\"alert('Added');return false\" on the actual button in shoppingcart.cs but when I click it, nothing happens. Is something else taking over the click event?
Chris Martz
United Art & Education
You're right - the code has changed since last time we implemented an event like this.
Instead, look at the javascript file:
\jscripts\product.js
And this function:
onButtonClick: function(cartType) {
It looks like this function fires for add to cart, add to wishlist, add to registry so test for cartType if necessary.
Thanks valentim! I was already working in that file and never looked for that function.
Chris Martz
United Art & Education