Can't append [removed] element

后端 未结 18 2191
被撕碎了的回忆
被撕碎了的回忆 2020-11-21 06:11

Any idea why the piece of code below does not add the script element to the DOM?

var code = \"\";
$(\"#someElement\").append(cod         


        
18条回答
  •  野性不改
    2020-11-21 06:51

    Try this may be helpful:

    var fileref=document.createElement('script');
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src","scriptAnalytics.js");
    document.getElementsByTagName("head")[0].appendChild(fileref);
    

提交回复
热议问题