javascript - JS: prototype event-observer not fireing -
i have magento test-shop onepagecheckout extension. uses onepagecheckout.js. there should added 'click'-event observers payment radio buttons. when clicking on them, nothing happens.
the observers added single input elements while each-ing through them:
addobservers: function () { $$('input[name="payment[method]"]').each(function (el) { el.observe('click', function () { checkout.update({ 'review': 1, 'payment-changed': 1 }); }); }); }
the eached elements are, can seen in chrome debugger , fit input-element ids , names:
el = input#p_method_bankpayment.radio el = input#p_method_paypal_express.radio el = input#p_method_cashondelivery.radio el = input#p_method_phoenix_cashondelivery.radio
the update function calling new content via ajax when page loaded, not executed , no network-activity can seen, when events should fired.
the installation can seen here: http://5.175.9.22/gp_de/onepagecheckout/ (put in cart/warenkorb, go checkout/zur kasse, not further)
can tell me why observers not working? other installations working extensions, what's
your input elements hidden by
style="display:none;"
so nobody can click them. if remove display:none in dev-tools , click radio button, alert 'click' pops up.
try use change event instead of click
addobservers: function () { $$('input[name="payment[method]"]').each(function (el) { el.observe('change', function () { checkout.update({ 'review': 1, 'payment-changed': 1 }); }); }); }
update: i've taken closer this. not work change event, because there onclick attributes on each radiobutton. these not triggered 'onchange'. try trigger (example):
onclick="payment.switchmethod('phoenix_cashondelivery')"
event this
$$('input[name="payment[method]"]').each(function (el) { el.observe('change', function () { $(this).simulate('click'); checkout.update({ 'review': 1, 'payment-changed': 1 }); }); });
Comments
Post a Comment