【问题标题】:Using different version of jquery on different ASP.NET MVC在不同的 ASP.NET MVC 上使用不同版本的 jquery
【发布时间】:2013-11-28 13:00:27
【问题描述】:

我目前正在使用 JQuery 1.7NOPCommerce 3.0 网站工作。它的所有页面都依赖于此。在站点中,我创建了一个使用 JQuery 2.0 创建的部分(1.7 不支持该部分,因此我必须使用 2.0)。那么现在我该如何更改引用,以便我的部分视图使用 JQuery 2.0 而不是 JQuery 1.7

我已经放了脚本标签来创建另一个引用,但是由于尝试中的 JQuery 冲突,它只会给我错误

【问题讨论】:

标签: javascript jquery asp.net-mvc-4 nopcommerce


【解决方案1】:

Can I use multiple versions of jQuery on the same page?找到这个

<!-- load jQuery 1.1.3 -->
<script type="text/javascript" src="http://example.com/jquery-1.1.3.js"></script>
<script type="text/javascript">
var jQuery_1_1_3 = $.noConflict(true);
</script>

<!-- load jQuery 1.3.2 -->
<script type="text/javascript" src="http://example.com/jquery-1.3.2.js"></script>
<script type="text/javascript">
var jQuery_1_3_2 = $.noConflict(true);
</script>


Then, instead of 
$('#selector').function();, you'd do jQuery_1_3_2('#selector').function(); 
or jQuery_1_1_3('#selector').function();

【讨论】:

    猜你喜欢
    • 2011-03-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 2018-09-29
    • 2016-03-03
    • 1970-01-01
    相关资源
    最近更新 更多