Hi - I'm wanting to overload the function that displays and hides the Shipping Address block so that at the same time, it hides and displays another block. In my checkout template I've added the following code -
function displayCheckoutPicture(obj) {
if (obj.checked) {
jQuery("#totseat_checkout_picture").hide();
} else {
jQuery("#totseat_checkout_picture").show();
}
}
jQuery("document").ready(function(){
var htmlPicture = '<div id="totseat_checkout_picture"></div>';
$(htmlPicture).insertBefore('#fc_address_shipping_container');
FC.checkout.overload("displayShippingAddress", "displayCheckoutPicture", null);
});
As far as I can tell, looking at what happens in firebug, the additional function is being run but doesn't seem to be successfully setting the visibility of the
#totseat_checkout_picture block. It seems that if the new div is hidden the first time the code is run then it shows the block (which it shouldn't) and then it stays visible regardless of what happens with the checkbox. So it seems as if it thinks that obj.checked is false all the time.
Any idea what's going on?
Thanks,
Gordon
With overload, the arguments to the original function are passed in an array - so you'll need to check "obj[0].checked" instead.