View Full Version : PLS HELP! onClick won't work after display switch

12-06-2009, 01:31 PM
This is driving me crazy!

So I'm using a javascript file to switch out items when a thumbnail is clicked. This includes photo, title, description, price, size, quantity and add to cart button....

The original code on the html file works fine, but as soon as it is swapped by onclick, the 'add to cart' button does nothing!

Here is the code:

var addDisplay = document.getElementById('cart-add');
addDisplay.innerHTML = "<a class='item_add' href='/' onclick='simpleCart.add(); return false;'><img src='images/shop/cart-add.jpg' width='118' height='26' border='0'></a>";

that is what shows in my javascript file...

here is what's on the html file:

<div id="cart-add"><a class='item_add' href='/' onclick='simpleCart.add(); return false;'><img src="images/shop/cart-add.jpg" width="118" height="26" border="0"></a>

and that adds the item to the cart just fine, but when a thumbnail is clicked on, activating the javascript file to switch out the item/elements, the 'add to cart' button no longer does anything... by the way, I am using simpleCart.js (http://simplecartjs.com/)


Please PM me if you need more info... or post here if you have a solution. Thanks!

Old Pedant
12-07-2009, 12:06 AM
I'm beginning to believe that simpleCart.js was invented to cause tons of people to lose lots of time finding all the problems. It's neither simple (internally) nor particularly well written, by today's standards.


I have no idea what you mean by "swapped out" since the code being "swapped in" there is identical to what's already in place.

Can you show this live on a test site???