简体   繁体   English

Javascript 脚本在动态添加到组件后不起作用

[英]Javascript script doesn't work after adding it dynamically to component

I created a component dynamically and I added the tag script to it but the code inside doesn't work I tried a lot of solutions but none of them work for me, please check the code我动态创建了一个组件,并在其中添加了标签脚本,但里面的代码不起作用我尝试了很多解决方案,但没有一个对我有用,请检查代码

代码图片

html图片

I used jQuery document.ready and it's working now fine for me after injecting it with a dynamic component我使用了 jQuery document.ready 并且在注入动态组件后它现在对我来说工作正常

 $(document).ready(function(){  
  $("#prep_abs_rup_eval").change(function(){ 
    if($("#prep_abs_rup_eval").val()=='A'){
        $("#prep_abs_rup_score").val("20");
    } else {
        $("#prep_abs_rup_score").val("10");
    }
 }); 
}); 

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

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