lisisi
V2EX  ›  jQuery

<script id="aaa" src="xxx.com/foo.js"></script> 用 $.getScript(...) 可以把 id="aaa" 一起设置进去吗?

  •  
  •   lisisi · Apr 25, 2020 · 2876 views
    This topic created in 2214 days ago, the information mentioned may be changed or developed.

    一般都是只是获取 url:

    $.getScript("xxx.com/foo.js" ...
    

    用 $.getScript(...) 怎么把 id="aaa" 一起设置进去吗?

    <script id="aaa" src="xxx.com/foo.js"></script>
    

    不行的话,也只能 create 一个 script 再设置 script 的 id 吗?

    2 replies    2020-04-25 20:48:26 +08:00
    yafoo
        1
    yafoo  
       Apr 25, 2020 via Android
    你要传参吗?换其他方式传吧
    airbasic
        2
    airbasic  
       Apr 25, 2020
    用$.getScript 你甚至无法搜到增加了<script>标签
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2644 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 15:08 · PVG 23:08 · LAX 08:08 · JFK 11:08
    ♥ Do have faith in what you're doing.