Magento: 产品页面下jquery change函数失效 Call javascript function onchange product option on Magento product page

明显的原因是change函数跟magento默认的onchange函数冲突。

一个方法是编辑 /js/varien/configurable.js  文件 : Place call to your function just above return; in function reloadPrice: function()

另一个不修改核心文件的方法是:

Try

 $(document).on('change','#multiid',function(){
    alert('Change Happened');
});

As your select-box is generated from the code, so you have to use event delegation, where in place of $(document) you can have closest parent element.

Or

$(document.body).on('change','#multiid',function(){
    alert('Change Happened');
});

参考:http://stackoverflow.com/a/19194194

 

本文: Magento: 产品页面下jquery change函数失效 Call javascript function onchange product option on Magento product page

Loading

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.