how to include jquery in another javascript file(如何在另一个 javascript 文件中包含 jquery)
问题描述
我有一个 javascript 文件,我想在这个 js 文件中包含 jquery.你有什么建议吗?
I have a javascript file and I want to include jquery in this js file. Do you have a suggestion?
推荐答案
在包含您自己的 JavaScript 之前,只需包含 jQuery 的 JavaScript:
Simply include the JavaScript for jQuery before you include your own JavaScript:
<script src="Ly9hamF4Lmdvb2dsZWFwaXMuY29tL2FqYXgvbGlicy9qcXVlcnkvMS42LjQvanF1ZXJ5Lm1pbi5qcw=="></script>
<script src="cGF0aC90by95b3VyL3NjcmlwdC5qcw=="></script>
虽然其他人建议简单地将 jQuery 复制并粘贴到您自己的 JavaScript 文件中,但最好将 jQuery 与规范源分开包含,因为这将允许您利用浏览器和中间服务器为此所做的缓存文件.
Though others have suggested simply copying and pasting jQuery into your own JavaScript file, it's really better to include jQuery separately from a canonical source as that will allow you to take advantage of the caching that your browser and intermediate servers have done for that file.
这篇关于如何在另一个 javascript 文件中包含 jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在另一个 javascript 文件中包含 jquery


- 从原点悬停时触发 translateY() 2022-01-01
- 如何显示带有换行符的文本标签? 2022-01-01
- 如何调试 CSS/Javascript 悬停问题 2022-01-01
- 如何向 ipc 渲染器发送添加回调 2022-01-01
- 使用 iframe URL 的 jQuery UI 对话框 2022-01-01
- 是否可以将标志传递给 Gulp 以使其以不同的方式 2022-01-01
- 为什么我的页面无法在 Github 上加载? 2022-01-01
- 为什么悬停在委托事件处理程序中不起作用? 2022-01-01
- 我不能使用 json 使用 react 向我的 web api 发出 Post 请求 2022-01-01
- 在不使用循环的情况下查找数字数组中的一项 2022-01-01