To reproduce this error, please kindly go to here.
Select “Color” and “Size” and click “Add to Cart”, when the “loading…” dialog box appears AND before it turns into the “added to cart” dialog box, click anywhere in the shade to cancel the dialog box, and then click any link on the page as fast as you can.
If you are fast enough, you can reproduce this alerted error:
Exception : TypeError: $("j2t-temp-div").down(".j2t_ajax_message") is undefined
(Firefox 9)
Exception : TypeError: Cannot read property 'innerHTML' of undefined
(Chrome 17)
No alerted error for IE 8.
My question is how do I suppress this error. I have accidentally stepped on it several times and I’m sure my users would do that as well by chance. And it doesn’t look pretty on a production site.
Is there any way to disable this exception while keeping the AJAX adding to cart feature?
Any idea would be appreciated. Thanks!
To suppress it, you can use
typeof:For example if you do:
where
someVarisn’t defined before, you will receive:But when you do:
It will suppress the error.
So you have to figure out which variable is causing that error after which you need to use
typeofcheck to suppress the message.