Using $.getScript (jquery): code is not executed

心已入冬 提交于 2019-12-05 05:32:39

I just solved my problem: when all document is loaded, $(function(){}) will not work again, so calling a script which uses $(function(){}) will no get run. I removed it from all my secondary-called scripts and now all works perfectly!

it might just be a loading order issue.

try encapsulating the JS loading in an onload function

$(window).load(function(){ 
    //get script loads here 
}

or

$(document).ready(function() {
   //get script loads here 
}

Sometimes I use one inside the other for dynamic JS script that needs to be loaded last.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!