简体   繁体   English

更改事件未从响应页面上的外部脚本触发

[英]change event not firing from external script on react page

I have loaded my script as an external script in a 3rd party site that is on react.我已将我的脚本作为外部脚本加载到正在响应的 3rd 方站点中。

  $(function () {
    $('#shopify-section-product .selector-wrapper').change(function(e) {
       console.log('change!!!');
    });
  });

The above change is not firing, I had put a debugger but nothing working out.上面的更改没有触发,我已经放置了一个调试器,但没有任何效果。 Strange thing though, if I put the change code in the console, it logging correctly.奇怪的是,如果我将change code放在控制台中,它会正确记录。

Is it something blocked by reactjs onChange?是不是被 reactjs onChange 阻止了? Any help would be appreciated.任何帮助,将不胜感激。

Try with this code尝试使用此代码

$(function () {
    $(document).on('change', '#shopify-section-product .selector-wrapper', function(e) {
       console.log('change!!!');
    });
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM