改变“src” < script>的属性 [英] Changing "src" attribute of <script>

查看:99
本文介绍了改变“src” < script>的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Jquery.attr()更改现有< script> 元素的src属性?它似乎是一个简单的方法来让JSONP工作,但我无法为我工作。

Is it possible to change the "src" attribute of an existing <script> element using Jquery.attr()? It seemed like a simple way to get JSONP to work but I am not able to make this work for me.

脚本的 src 只能设置一次!无法更改DOM中现有< script> 元素的 src 属性。但是,动态创建的< script> 元素可以有其源设置(但恰好一次!)

It turns out that a script's src can only be set once! It is not possible to change the src attribute of an existing <script> element in the DOM. However, a dynamically created <script> element can have its source set (but exactly once!)

这篇关于改变“src” &lt; script&gt;的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆