gpt4 book ai didi

javascript - jQuery 未注册 $

转载 作者:行者123 更新时间:2023-11-28 11:05:14 24 4
gpt4 key购买 nike

我在网站上使用原型(prototype)+ jquery。现在原型(prototype)插件使用 $.我不希望 jQuery 使用 $.如何让 jQuery 不注册 $.另外,我如何调用 jQuery 函数。

感谢您的宝贵时间。

最佳答案

jQuery documentation有一篇关于如何使 jQuery 与其他库良好配合的文章。

这是该文章中建议的一种方法:

<html>
<head>
<script src="prototype.js"></script>
<script src="jquery.js"></script>
<script>
jQuery.noConflict();

// Put all your code in your document ready area
jQuery(document).ready(function($){
// Do jQuery stuff using $
$("div").hide();
});

// Use Prototype with $(...), etc.
$('someid').hide();
</script>
</head>
<body></body>
</html>

关于javascript - jQuery 未注册 $,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1005340/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com